Skip to content

Commit 87ad2c3

Browse files
committed
First pass at remaining issues
- Removed VK_PRESENT_STAGE_IMAGE_LATCHED_BIT_EXT as we couldn't agree on its semantics. Replaced with VK_PRESENT_STAGE_REQUEST_DEQUEUED_BIT_EXT which should be clearer, as "dequeue"'ing a request is already mentioned in the spec. - Swapchains that require presents to be made before being able to return timing properties should now return VK_NOT_READY from vkGetSwapchainTimingPropertiesEXT - Renamed "variableRefreshDelay" to "refreshInterval". Spec wording is still a bit fuzzy, but this allows to express scenarios where the vblank interval is decoupled from the display's true refresh rate, like Android's ARR. - VkPastPresentationTimingEXT now also reports the targetTime that was provided by the app. This is a usability thing that avoids the need to keep track of previous present times in the app. - Removed targetPresentStage: it didn't make sense from API perspective. Presentation engine now makes a "best effort" approach to hit VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT with the target present time. This is unfortunately the best we can do at the moment due to multiple platforms restrictions. As a result, presentAtNearestRefreshCycle is now merely a hint instead of a requirement. - Added description for the remaining issues in the proposal - Move vkGetSwapchain*PropertiesEXT optional counter parameter at the end. This is closer to the overall API style and fixes issues with vulkan.hpp generation. - Reference VK_KHR_present_id2 instead of VK_KHR_present_id - 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 cd97197 commit 87ad2c3

File tree

6 files changed

+266
-287
lines changed

6 files changed

+266
-287
lines changed

chapters/VK_EXT_present_timing/PresentTimeInfo.adoc

Lines changed: 82 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2014-2024 Khronos Group.
1+
// Copyright (c) 2014-2025 Khronos Group.
22
//
33
// SPDX-License-Identifier: CC-BY-4.0
44

@@ -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 or duration 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-
sname: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 do not support a target presentation time or duration.
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,77 +56,96 @@ 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
81-
indicating which present stages the presentation engine should collect
68+
indicating which present stages the presentation engine will collect
8269
timing information for.
83-
* pname:targetPresentStage is zero or a tlink:VkPresentStageFlagsEXT value
84-
specifying which present stage pname:time is targeting.
85-
* pname:presentAtRelativeTime specifies whether pname:time is to be
86-
interpreted as an absolute or a relative time value.
87-
* pname:presentAtNearestRefreshCycle is a flag indicating that the
88-
application would like the presentation engine to complete
89-
pname:targetPresentStage at the start of the refresh cycle that is
90-
closest to pname:time.
91-
92-
If pname:targetPresentStage is not zero, the presentation engine must: not
93-
complete the target present stage before the absolute time specified in
94-
pname:time according to the time domain used, unless
95-
pname:presentAtNearestRefreshCycle is ename:VK_TRUE and pname:time falls
96-
within the first half of a refresh cycle.
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+
====
9794

9895
[NOTE]
9996
.Note
10097
====
101-
Applications that use pname:targetPresentTime to specify an absolute present
102-
time should: regularly rebase their calculations for their next target time
103-
on the feedback from flink:vkGetPastPresentationTimingEXT to compensate for
104-
accumulated precision errors or potential clock drift. It is recommended
105-
that when targeting the time of a vertical blanking period, applications use
106-
pname:presentAtNearestRefreshCycle to allow the implementation to compensate
107-
for small precision errors that may cause an image to be displayed one
108-
refresh cycle later than intended.
98+
Applications that specify an absolute present time should: regularly rebase
99+
their calculations for their next target time on the feedback from
100+
flink:vkGetPastPresentationTimingEXT to compensate for accumulated precision
101+
errors or potential clock drift. It is recommended that when targeting the
102+
time of a vertical blanking period, applications use pname:presentAtNearestRefreshCycle
103+
to allow the implementation to compensate for small precision errors that may
104+
cause an image to be displayed one refresh cycle later than intended.
109105
====
110106

111107
.Valid Usage
112108
****
113-
* If pname:presentStageTarget is not zero, it must: specify one and only
114-
one stage.
115-
* pname:presentStageTarget must: not be
116-
ename:VK_PRESENT_STAGE_QUEUE_OPERATIONS_END_BIT_EXT
117-
* If pname:targetPresentStage is not zero, pname:presentAtRelativeTime must:
118-
be ename:VK_FALSE.
119-
* 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
120115
<<features-presentAtRelativeTime, pname:presentAtRelativeTime>> feature
121116
must: be enabled.
122117
****
123118

124119
include::{generated}/validity/structs/VkPresentTimingInfoEXT.adoc[]
125120
--
126121

127-
128-
[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.
129141
--
130142

131-
The sname:VkPresentTimeEXT union is defined as:
132-
133-
include::{generated}/api/structs/VkPresentTimeEXT.adoc[]
134-
135-
* pname:targetPresentTime, if non-zero, specifies the earliest time in
136-
nanoseconds the application wants the presentation engine to complete a
137-
specified target present stage. A value of zero specifies that the
138-
presentation engine may: display the image at any time allowed by the
139-
current present mode.
140-
* pname:presentDuration specifies the minimum duration in nanoseconds that
141-
must: separate the ename:VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_VISIBLE_BIT_EXT
142-
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[]
143146

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

147151
[open,refpage='VkPresentStageFlagBitsEXT',desc='Bitmask specifying stages of the image presentation process',type='enums']
@@ -155,9 +159,10 @@ include::{generated}/api/enums/VkPresentStageFlagBitsEXT.adoc[]
155159
* ename:VK_PRESENT_STAGE_QUEUE_OPERATIONS_END_BIT_EXT marks the end of the
156160
set of queue operations enqueued by flink:vkQueuePresentKHR on the provided
157161
sname:VkQueue for a presentation request.
158-
* ename:VK_PRESENT_STAGE_IMAGE_LATCHED_BIT_EXT is the stage after which the
159-
image associated with the presentation request has been latched by the
160-
presentation engine to create the presentation of a future refresh cycle.
162+
* ename:VK_PRESENT_STAGE_REQUEST_DEQUEUED_BIT_EXT is the stage after which
163+
the presentation request has been dequeued from the swapchain's internal
164+
presentation request queue, if any, as specified by the present mode
165+
associated with that request.
161166
* ename:VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_OUT_BIT_EXT is the stage after
162167
which data for the first pixel of the presentation request associated with
163168
the image has left the presentation engine for a display hardware.

0 commit comments

Comments
 (0)