Skip to content

Commit bc8b67f

Browse files
committed
Cleanup VkPresentTimingInfo
- Remove the VkPresentTimeEXT union, as it does not fit the style of Vulkan - Remove boolean members and replace them with a new flags type. - Cleanup some spec language and VUs.
1 parent 4cdfafb commit bc8b67f

File tree

5 files changed

+104
-104
lines changed

5 files changed

+104
-104
lines changed

chapters/VK_EXT_present_timing/PresentTimeInfo.adoc

Lines changed: 69 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -27,41 +27,26 @@ include::{generated}/api/structs/VkPresentTimingsInfoEXT.adoc[]
2727
information for the presentation of the image corresponding to the entry
2828
in the sname:VkPresentInfoKHR::pname:pImageIndices array.
2929

30-
The semantics of target presentation time vary depending on the presentation mode:
31-
32-
* ename:VK_PRESENT_MODE_FIFO_KHR.
33-
Tearing cannot: be observed.
34-
The first queued image is dequeued and presented if
35-
both: 1) its associated wait semaphore(s) have signaled, and 2)
36-
its target present time is less-than or equal-to the current time.
37-
* ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR.
38-
For images that are presented in time to be displayed at the next
39-
vertical blanking period, the semantics are identical as for
40-
ename:VK_PRESENT_MODE_FIFO_KHR.
41-
For images that are presented late, and are displayed after the start of
42-
the vertical blanking period (i.e. with tearing), the values of
43-
slink:VkPastPresentationTimingEXT may: be treated as if the image was
44-
displayed at the start of the vertical blanking period, or may: be
45-
treated the same as for ename:VK_PRESENT_MODE_IMMEDIATE_KHR.
46-
47-
Other presentation modes must: not be used with a target presentation time.
48-
4930
.Valid Usage
5031
****
51-
* pname:swapchainCount must: be the same value as
52-
sname:VkPresentInfoKHR::pname:swapchainCount, where
53-
sname:VkPresentInfoKHR is in the pname:pNext chain of this
54-
sname:VkPresentTimingsInfoEXT structure.
32+
* pname:swapchainCount must: be equal to
33+
slink:VkPresentInfoKHR::pname:swapchainCount.
34+
* All swapchains in slink:VkPresentInfoKHR::pname:pSwapchains must: have
35+
been created with the slink:VkSwapchainCreateInfoKHR::pname:flags field
36+
containing ename:VK_SWAPCHAIN_CREATE_PRESENT_TIMING_BIT_EXT
5537
* For each member of sname:VkPresentInfoKHR::pname:pSwapchains, if the
56-
associated sname:VkPresentTimeEXT is non-zero, the current present mode
57-
must: be ename:VK_PRESENT_MODE_FIFO_KHR or
38+
associated slink:VkPresentTimingInfoEXT::pname:targetTime is not zero,
39+
the swapchain's current present mode must: be
40+
ifdef::VK_KHR_present_mode_fifo_latest_ready[]
41+
ename:VK_PRESENT_MODE_FIFO_LATEST_READY_KHR,
42+
endif::VK_KHR_present_mode_fifo_latest_ready[]
43+
ename:VK_PRESENT_MODE_FIFO_KHR or
5844
ename:VK_PRESENT_MODE_FIFO_RELAXED_KHR.
5945
****
6046

6147
include::{generated}/validity/structs/VkPresentTimingsInfoEXT.adoc[]
6248
--
6349

64-
6550
[open,refpage='VkPresentTimingInfoEXT',desc='Specifies per-present timing information',type='structs']
6651
--
6752
The sname:VkPresentTimingInfoEXT structure is defined as:
@@ -71,31 +56,41 @@ include::{generated}/api/structs/VkPresentTimingInfoEXT.adoc[]
7156
* pname:sType is a elink:VkStructureType value identifying this structure.
7257
* pname:pNext is `NULL` or a pointer to a structure extending this
7358
structure.
74-
* pname:time is a sname:VkPresentTimeEXT specifying the target present
75-
time or duration of the presentation request.
59+
* pname:flags is a bitmask of elink:VkPresentTimingInfoFlagBitsEXT
60+
specifying options for how to interpret the timing information.
61+
* pname:targetTime is zero or a value specifying the target present
62+
time in nanoseconds of the presentation request.
7663
* pname:timeDomainId is the id of the time domain used to specify the
7764
absolute target present time and the timing results obtained in a
7865
subsequent flink:vkGetPastPresentationTimingEXT call for the current
7966
presentation request.
8067
* pname:presentStageQueries is a valid tlink:VkPresentStageFlagsEXT value
8168
indicating which present stages the presentation engine will collect
8269
timing information for.
83-
* pname:presentAtRelativeTime specifies whether pname:time is to be
84-
interpreted as an absolute or a relative time value.
85-
* pname:presentAtNearestRefreshCycle is a flag hinting at when the
86-
application would like the image to be visible relative to pname:time.
87-
88-
If pname:time is not zero, the implementation attempts to align the
89-
ename:VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT present stage with
90-
the time specified in pname:time according to the time domain used.
91-
92-
If pname:presentAtNearestRefreshCycle is ename:VK_TRUE, it indicates that
93-
the application would prefer the presentation engine to complete the
94-
ename:VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT stage at the time
95-
of the refresh cycle boundary that is closest to pname:time. Otherwise, if
96-
pname:presentAtNearestRefreshCycle is ename:VK_FALSE, it indicates that the
97-
application would prefer the image to not be visible earlier than
98-
pname:time.
70+
71+
If pname:targetTime is not zero, the implementation attempts to align the
72+
ename:VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT present stage of
73+
that presentation request with the time specified in pname:targetTime
74+
according to the time domain used. If
75+
ename:VK_PRESENT_TIMING_INFO_PRESENT_AT_NEAREST_REFRESH_CYCLE_BIT_EXT is not
76+
set in pname:flags, it indicates that the application would strictly prefer
77+
the image to not be visible before pname:targetTime has lapsed.
78+
79+
[NOTE]
80+
.Note
81+
====
82+
Some platforms, due to hardware or system limitations, may: not be able to
83+
accurately time pname:targetTime with the actual physical event of the image
84+
becoming visible on the display. However, those timing capabilities may:
85+
still be useful and result in improved animation quality.
86+
87+
As such, the <<features-presentAtAbsoluteTime, pname:presentAtAbsoluteTime>>
88+
and <<features-presentAtRelativeTime, pname:presentAtRelativeTime>> features
89+
do not provide a strict guarantee regarding the completion of the
90+
ename:VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT present stage
91+
relative to the pname:targetTime, and implementations must: strive to make
92+
it as consistent and accurate as possible.
93+
====
9994

10095
[NOTE]
10196
.Note
@@ -111,32 +106,46 @@ cause an image to be displayed one refresh cycle later than intended.
111106

112107
.Valid Usage
113108
****
114-
* If pname:presentAtRelativeTime is ename:VK_TRUE, the
109+
* If pname:targetTime is not zero and pname:flags does not contain
110+
ename:VK_PRESENT_TIMING_INFO_PRESENT_AT_RELATIVE_TIME_BIT_EXT, the
111+
<<features-presentAtAbsoluteTime, pname:presentAtAbsoluteTime>> feature
112+
must: be enabled.
113+
* If pname:targetTime is not zero and pname:flags contains
114+
ename:VK_PRESENT_TIMING_INFO_PRESENT_AT_RELATIVE_TIME_BIT_EXT, the
115115
<<features-presentAtRelativeTime, pname:presentAtRelativeTime>> feature
116116
must: be enabled.
117117
****
118118

119119
include::{generated}/validity/structs/VkPresentTimingInfoEXT.adoc[]
120120
--
121121

122-
123-
[open,refpage='VkPresentTimeEXT',desc='Specifying when an image should be presented',type='structs']
122+
[open,refpage='VkPresentTimingInfoFlagBitsEXT',desc='Bitmask specifying present timing info flags',type='enums']
123+
--
124+
Bits which can: be set in slink:VkPresentTimingInfoEXT::pname:flags, specifying options
125+
for how to interpret timing information:
126+
127+
include::{generated}/api/enums/VkPresentTimingInfoFlagBitsEXT.adoc[]
128+
129+
* ename:VK_PRESENT_TIMING_INFO_PRESENT_AT_RELATIVE_TIME_BIT_EXT specifies
130+
that sname:VkPresentTimingInfoEXT::pname:targetTime is to be interpreted
131+
as a relative time from the previous presentation's
132+
ename:VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT stage. If the
133+
pname:swapchain has never been used to present an image, the provided
134+
pname:targetTime is ignored.
135+
* ename:VK_PRESENT_TIMING_INFO_PRESENT_AT_NEAREST_REFRESH_CYCLE_BIT_EXT
136+
specifies that the application would prefer the image to be presented
137+
earlier than the time specified in
138+
sname:VkPresentTimingInfoEXT::pname:targetTime if that time falls within
139+
the first half of a refresh cycle. In that case, the presentation engine
140+
may: choose to display the image at the start of that refresh cycle.
124141
--
125142

126-
The sname:VkPresentTimeEXT union is defined as:
127-
128-
include::{generated}/api/structs/VkPresentTimeEXT.adoc[]
129-
130-
* pname:targetPresentTime, if non-zero, specifies the earliest time in
131-
nanoseconds the application wants the presentation engine to complete a
132-
specified target present stage. A value of zero specifies that the
133-
presentation engine may: display the image at any time allowed by the
134-
current present mode.
135-
* pname:presentDuration specifies the minimum duration in nanoseconds that
136-
must: separate the ename:VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT
137-
present stages of the current and the next presentation requests, if any.
143+
[open,refpage='VkPresentTimingInfoFlagsEXT',desc='Bitmask of VkPresentTimingInfoFlagBitsEXT',type='flags']
144+
--
145+
include::{generated}/api/flags/VkPresentTimingInfoFlagsEXT.adoc[]
138146

139-
include::{generated}/validity/structs/VkPresentTimeEXT.adoc[]
147+
tname:VkPresentTimingInfoFlagsEXT is a bitmask type for setting a mask
148+
of zero or more elink:VkPresentTimingInfoFlagBitsEXT.
140149
--
141150

142151
[open,refpage='VkPresentStageFlagBitsEXT',desc='Bitmask specifying stages of the image presentation process',type='enums']

chapters/VK_KHR_surface/wsi.adoc

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,21 +1076,15 @@ include::{generated}/api/structs/VkPresentTimingSurfaceCapabilitiesEXT.adoc[]
10761076
slink:VkPhysicalDeviceSurfaceInfo2KHR::pname:surface.
10771077
* pname:presentAtAbsoluteTimeSupported indicates whether a swapchain
10781078
created from slink:VkPhysicalDeviceSurfaceInfo2KHR::pname:surface
1079-
supports presenting images with absolute times using
1080-
slink:VkPresentTimeEXT::pname:targetPresentTime.
1079+
supports presenting images with absolute times.
10811080
* pname:presentAtRelativeTimeSupported indicates whether a swapchain
10821081
created from slink:VkPhysicalDeviceSurfaceInfo2KHR::pname:surface
1083-
supports presenting images with relative times using
1084-
slink:VkPresentTimeEXT::pname:presentDuration.
1082+
supports presenting images with relative times.
10851083
* pname:presentStageQueries is a bitmask of
10861084
elink:VkPresentStageFlagBitsEXT indicating which present stages a
10871085
swapchain created from
10881086
slink:VkPhysicalDeviceSurfaceInfo2KHR::pname:surface is able to provide
10891087
timing information for.
1090-
* pname:presentStageTargets is a bitmask of
1091-
elink:VkPresentStageFlagBitsEXT indicating which present stages a
1092-
swapchain created from slink:VkPhysicalDeviceSurfaceInfo2KHR::pname:surface
1093-
is able to provide target present times for.
10941088

10951089
include::{generated}/validity/structs/VkPresentTimingSurfaceCapabilitiesEXT.adoc[]
10961090
--

chapters/features.adoc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6536,11 +6536,9 @@ This structure describes the following feature:
65366536
* [[features-presentTiming]] pname:presentTiming indicates that the
65376537
implementation supports fname:vkGetPastPresentationTimingEXT.
65386538
* [[features-presentAtAbsoluteTime]] pname:presentAtAbsoluteTime indicates
6539-
that the implementation supports specifying present times with
6540-
sname:VkPresentTimeEXT::pname:targetPresentTime.
6539+
that the implementation supports specifying absolute target present times.
65416540
* [[features-presentAtRelativeTime]] pname:presentAtRelativeTime indicates
6542-
that the implementation supports specifying relative present times with
6543-
sname:VkPresentTimeEXT::pname:presentDuration.
6541+
that the implementation supports specifying relative target present times.
65446542

65456543
:refpage: VkPhysicalDevicePresentTimingFeaturesEXT
65466544
include::{chapters}/features.adoc[tag=features]

proposals/VK_EXT_present_timing.adoc

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -297,19 +297,13 @@ A new struct `VkPresentTimingsInfoEXT` can be appended to the `VkPresentInfoKHR`
297297

298298
[source,c]
299299
----
300-
typedef union VkPresentTimeEXT {
301-
uint64_t targetPresentTime;
302-
uint64_t presentDuration;
303-
} VkPresentTimeEXT;
304-
305300
typedef struct VkPresentTimingInfoEXT {
306301
VkStructureType sType;
307302
const void* pNext;
308-
VkPresentTimeEXT time;
303+
VkPresentTimingInfoFlags flags;
304+
uint64_t targetTime;
309305
uint64_t timeDomainId;
310306
VkPresentStageFlagsEXT presentStageQueries;
311-
VkBool32 presentAtRelativeTime;
312-
VkBool32 presentAtNearestRefreshCycle;
313307
} VkPresentTimingInfoEXT;
314308
315309
typedef struct VkPresentTimingsInfoEXT {
@@ -321,28 +315,31 @@ typedef struct VkPresentTimingsInfoEXT {
321315
----
322316
For each swapchain referenced in `VkPresentInfoKHR`, a `VkPresentTimingInfoEXT` is specified:
323317

324-
* `time` is the absolute or relative time used to schedule this presentation request.
318+
* `targetTime` is the absolute or relative time used to schedule this presentation request.
325319
* `timeDomainId` is the id of the time domain used to specify `time` and to query timing results.
326320
* `presentStageQueries` is a bitmask specifying all the present stages the application would like timings for.
327-
* `presentAtRelativeTime` specifies whether `time` is to be interpreted as an absolute or a relative time value.
328-
* `presentAtNearestRefreshCycle` specifies that the application would like to present at the refresh cycle that is nearest to the target present time.
329321

330-
`VkPresentTimeEXT` is interpreted according to the `VkPresentTimingInfoEXT::presentAtRelativeTime` flag:
322+
If `presentStageQueries` is not zero, and the swapchain's internal timing queue is full, calling `vkQueuePresentKHR` yields a new error: `VK_ERROR_PRESENT_TIMING_QUEUE_FULL_EXT`.
323+
324+
The semantics of specifying a target present time only apply to FIFO present modes (`VK_PRESENT_MODE_FIFO_KHR`, `VK_PRESENT_MODE_FIFO_RELAXED_KHR` and `VK_PRESENT_MODE_FIFO_LATEST_READY_KHR`). When attempting to dequeue a presentation request from the FIFO queue, the presentation engine checks the current time against the target time.
325+
326+
The `VkPresentTimingInfoFlags` flags are defined as:
327+
[source,c]
328+
----
329+
typedef enum VkPresentTimingInfoFlagBitsEXT {
330+
VK_PRESENT_TIMING_INFO_PRESENT_AT_RELATIVE_TIME_BIT_EXT = 0x00000001,
331+
VK_PRESENT_TIMING_INFO_PRESENT_AT_NEAREST_REFRESH_CYCLE_BIT_EXT = 0x00000002
332+
} VkPresentStageFlagBitsEXT;
333+
----
334+
`VK_PRESENT_TIMING_INFO_PRESENT_AT_RELATIVE_TIME_BIT_EXT` specifies whether `time` is to be interpreted as an absolute or a relative time value. If `time` is interpreted as an absolute time, it specifies the earliest time in nanoseconds at which the image should be visible. Otherwise, if it is interpreted as a relative time, it specifies the minimum duration in nanoseconds the previously presented image should be visible.
331335

332-
* `targetPresentTime` specifies the earliest time in nanoseconds at which the image should be visible.
333-
* `presentDuration` specifies the minimum duration in nanoseconds the image should be visible.
336+
If `VK_PRESENT_TIMING_INFO_PRESENT_AT_NEAREST_REFRESH_CYCLE_BIT_EXT` is set, it indicates that the application would prefer the image to be made visible during the refresh cycle that is closest to the target present time, even if that refresh cycle starts earlier than the specified `time`.
334337

335338
[NOTE]
336339
====
337340
More specifically, the implementation attempts to align the `VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT` present stage with the requested target present time.
338341
====
339342

340-
If `presentStageQueries` is not zero, and the swapchain's internal timing queue is full, calling `vkQueuePresentKHR` yields a new error: `VK_ERROR_PRESENT_TIMING_QUEUE_FULL_EXT`.
341-
342-
`presentAtNearestRefreshCycle` indicates whether the application prefers that the image be visible during the refresh cycle that is closer to the target present time, or if the presentation engine should hold presentation until the target present time has strictly passed.
343-
344-
The semantics of specifying a target present time only apply to FIFO present modes (`VK_PRESENT_MODE_FIFO_KHR`, `VK_PRESENT_MODE_FIFO_RELAXED_KHR` and `VK_PRESENT_MODE_FIFO_LATEST_READY_KHR`). When attempting to dequeue a presentation request from the FIFO queue, the presentation engine checks the current time against the target time.
345-
346343
[NOTE]
347344
====
348345
To maintain a constant image present duration (IPD), applications should use timing information collected via `vkGetPastPresentationTimingEXT` to determine the target time of each present. If the presentation engine is operating with a fixed refresh rate, the application's IPD should be a multiple of `VkSwapchainTimingPropertiesEXT::refreshInterval`. That is, the quanta for changing the IPD is `refreshInterval`. For example, if `refreshDuration` is 16.67ms, the IPD can be 16.67ms, 33.33ms, 50.0ms, etc.

0 commit comments

Comments
 (0)