You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: chapters/depth.adoc
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -127,7 +127,7 @@ When clearing, notice that `VkClearValue` is a union and `VkClearDepthStencilVal
127
127
[[pre-rasterization]]
128
128
== Pre-rasterization
129
129
130
-
In the graphics pipeline, there are a series of link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#pipeline-graphics-subsets-pre-rasterization[pre-rasterization shader stages] that generate primitives to be rasterized. Before reaching the rasterization step, the final `vec4` position (`gl_Position`) of the last pre-rasterization stage runs through link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#vertexpostproc[Fixed-Function Vertex Post-Processing].
130
+
In the graphics pipeline, there are a series of link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#pipeline-graphics-subsets-pre-rasterization[pre-rasterization shader stages] that generate primitives to be rasterized. Before reaching the rasterization step, the final `vec4` position (`gl_Position`) of the last pre-rasterization stage runs through link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#vertexpostproc[Fixed-Function Vertex Post-Processing].
131
131
132
132
The following gives a high level overview of the various coordinates name and operations that occur before rasterization.
133
133
@@ -155,7 +155,7 @@ A few examples where `Zd` is the result of `Zc`/`Wc`:
155
155
[[user-defined-clipping-and-culling]]
156
156
==== User defined clipping and culling
157
157
158
-
Using `ClipDistance` and `CullDistance` built-in arrays the link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#pipeline-graphics-subsets-pre-rasterization[pre-rasterization shader stages] can set link:https://www.khronos.org/opengl/wiki/Vertex_Post-Processing#User-defined_clipping[user defined clipping and culling].
158
+
Using `ClipDistance` and `CullDistance` built-in arrays the link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#pipeline-graphics-subsets-pre-rasterization[pre-rasterization shader stages] can set link:https://www.khronos.org/opengl/wiki/Vertex_Post-Processing#User-defined_clipping[user defined clipping and culling].
159
159
160
160
In the last pre-rasterization shader stage, these values will be linearly interpolated across the primitive and the portion of the primitive with interpolated distances less than `0` will be considered outside the clip volume. If `ClipDistance` or `CullDistance` are then used by a fragment shader, they contain these linearly interpolated values.
161
161
@@ -176,7 +176,7 @@ In OpenGL the `view volume` is expressed as
176
176
177
177
and anything outside of `[-1, 1]` is clipped.
178
178
179
-
The link:https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_depth_clip_control.html[VK_EXT_depth_clip_control] extension was added to allow efficient layering of OpenGL over Vulkan. By setting the `VkPipelineViewportDepthClipControlCreateInfoEXT::negativeOneToOne` to `VK_TRUE` when creating the `VkPipeline` it will use the OpenGL `[-1, 1]` view volume.
179
+
The link:https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_depth_clip_control.html[VK_EXT_depth_clip_control] extension was added to allow efficient layering of OpenGL over Vulkan. By setting the `VkPipelineViewportDepthClipControlCreateInfoEXT::negativeOneToOne` to `VK_TRUE` when creating the `VkPipeline` it will use the OpenGL `[-1, 1]` view volume.
180
180
181
181
If `VK_EXT_depth_clip_control` is not available, the link:https://github.com/KhronosGroup/Vulkan-Docs/issues/1054#issuecomment-547202276[workaround currently] is to perform the conversion in the pre-rasterization shader
182
182
@@ -195,7 +195,7 @@ The list of viewports being used in the pipeline is expressed by `VkPipelineView
195
195
196
196
[NOTE]
197
197
====
198
-
The viewport value can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_VIEWPORT` or the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT` from link:https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state.html[VK_EXT_extended_dynamic_state].
198
+
The viewport value can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_VIEWPORT` or the `VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT` from link:https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_extended_dynamic_state.html[VK_EXT_extended_dynamic_state].
199
199
====
200
200
201
201
[[depth-range]]
@@ -208,7 +208,7 @@ Each viewport holds a `VkViewport::minDepth` and `VkViewport::maxDepth` value wh
208
208
Despite their names, `minDepth` can be less than, equal to, or greater than `maxDepth`.
209
209
====
210
210
211
-
The `minDepth` and `maxDepth` are restricted to be set inclusively between `0.0` and `1.0`. If the link:https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_depth_range_unrestricted.html[VK_EXT_depth_range_unrestricted] is enabled, this restriction goes away.
211
+
The `minDepth` and `maxDepth` are restricted to be set inclusively between `0.0` and `1.0`. If the link:https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_depth_range_unrestricted.html[VK_EXT_depth_range_unrestricted] is enabled, this restriction goes away.
212
212
213
213
The framebuffer depth coordinate `Zf` is represented as:
214
214
@@ -229,7 +229,7 @@ Zf = Pz * Zd + Oz
229
229
230
230
The depth values of all fragments generated by the rasterization of a polygon can be offset by a single value that is computed for that polygon. If `VkPipelineRasterizationStateCreateInfo::depthBiasEnable` is `VK_FALSE` at draw time, no depth bias is applied.
231
231
232
-
Using the `depthBiasConstantFactor`, `depthBiasClamp`, and `depthBiasSlopeFactor` in `VkPipelineRasterizationStateCreateInfo` the depth bias link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#primsrast-depthbias[can be calculated].
232
+
Using the `depthBiasConstantFactor`, `depthBiasClamp`, and `depthBiasSlopeFactor` in `VkPipelineRasterizationStateCreateInfo` the depth bias link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#primsrast-depthbias[can be calculated].
233
233
234
234
[NOTE]
235
235
====
@@ -238,7 +238,7 @@ Requires the `VkPhysicalDeviceFeatures::depthBiasClamp` feature to be supported
238
238
239
239
[NOTE]
240
240
====
241
-
The depth bias values can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_DEPTH_BIAS` or the `VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT` from link:https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state2.html[VK_EXT_extended_dynamic_state2].
241
+
The depth bias values can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_DEPTH_BIAS` or the `VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT` from link:https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_extended_dynamic_state2.html[VK_EXT_extended_dynamic_state2].
242
242
====
243
243
244
244
[[post-rasterization]]
@@ -284,9 +284,9 @@ Violating the condition yields undefined behavior.
284
284
[[per-sample-processing-and-coverage-mask]]
285
285
=== Per-sample processing and coverage mask
286
286
287
-
The following post-rasterization occurs as a "per-sample" operation. This means when doing link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#fragops-covg[multisampling] with a color attachment, any "depth buffer" `VkImage` used as well must also have been created with the same `VkSampleCountFlagBits` value.
287
+
The following post-rasterization occurs as a "per-sample" operation. This means when doing link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#fragops-covg[multisampling] with a color attachment, any "depth buffer" `VkImage` used as well must also have been created with the same `VkSampleCountFlagBits` value.
288
288
289
-
Each fragment has a link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#primsrast-multisampling-coverage-mask[coverage mask] based on which samples within that fragment are determined to be within the area of the primitive that generated the fragment. If a fragment operation results in all bits of the coverage mask being `0`, the fragment is discarded.
289
+
Each fragment has a link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#primsrast-multisampling-coverage-mask[coverage mask] based on which samples within that fragment are determined to be within the area of the primitive that generated the fragment. If a fragment operation results in all bits of the coverage mask being `0`, the fragment is discarded.
290
290
291
291
[[resolving-depth-buffer]]
292
292
==== Resolving depth buffer
@@ -301,11 +301,11 @@ It is possible in Vulkan using the xref:{chapters}extensions/cleanup.adoc#vk_khr
301
301
Requires the `VkPhysicalDeviceFeatures::depthBounds` feature to be supported.
302
302
====
303
303
304
-
If `VkPipelineDepthStencilStateCreateInfo::depthBoundsTestEnable` is used to take each `Za` in the depth attachment and check if it is within the range set by `VkPipelineDepthStencilStateCreateInfo::minDepthBounds` and `VkPipelineDepthStencilStateCreateInfo::maxDepthBounds`. If the value is not within the bounds, the link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#primsrast-multisampling-coverage-mask[coverage mask] is set to zero.
304
+
If `VkPipelineDepthStencilStateCreateInfo::depthBoundsTestEnable` is used to take each `Za` in the depth attachment and check if it is within the range set by `VkPipelineDepthStencilStateCreateInfo::minDepthBounds` and `VkPipelineDepthStencilStateCreateInfo::maxDepthBounds`. If the value is not within the bounds, the link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#primsrast-multisampling-coverage-mask[coverage mask] is set to zero.
305
305
306
306
[NOTE]
307
307
====
308
-
The depth bound values can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_DEPTH_BOUNDS` or the `VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT` from link:https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state.html[VK_EXT_extended_dynamic_state].
308
+
The depth bound values can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_DEPTH_BOUNDS` or the `VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT` from link:https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_extended_dynamic_state.html[VK_EXT_extended_dynamic_state].
309
309
====
310
310
311
311
[[depth-test]]
@@ -330,17 +330,17 @@ An example where `depthCompareOp` == `VK_COMPARE_OP_LESS` (`Zf` < `Za`)
330
330
331
331
[NOTE]
332
332
====
333
-
The `depthTestEnable` and `depthCompareOp` value can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT` and `VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT` from link:https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state.html[VK_EXT_extended_dynamic_state].
333
+
The `depthTestEnable` and `depthCompareOp` value can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT` and `VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT` from link:https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_extended_dynamic_state.html[VK_EXT_extended_dynamic_state].
334
334
====
335
335
336
336
[[depth-buffer-writes]]
337
337
==== Depth Buffer Writes
338
338
339
-
Even if the depth test passes, if `VkPipelineDepthStencilStateCreateInfo::depthWriteEnable` is set to `VK_FALSE` it will not write the value out to the depth attachment. The main reason for this is because the depth test itself will set the link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#primsrast-multisampling-coverage-mask[coverage mask] which can be used for certain render techniques.
339
+
Even if the depth test passes, if `VkPipelineDepthStencilStateCreateInfo::depthWriteEnable` is set to `VK_FALSE` it will not write the value out to the depth attachment. The main reason for this is because the depth test itself will set the link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#primsrast-multisampling-coverage-mask[coverage mask] which can be used for certain render techniques.
340
340
341
341
[NOTE]
342
342
====
343
-
The `depthWriteEnable` value can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT` from link:https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_EXT_extended_dynamic_state.html[VK_EXT_extended_dynamic_state].
343
+
The `depthWriteEnable` value can be set xref:{chapters}dynamic_state.adoc[dynamically] using `VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT` from link:https://registry.khronos.org/vulkan/specs/latest/man/html/VK_EXT_extended_dynamic_state.html[VK_EXT_extended_dynamic_state].
Copy file name to clipboardExpand all lines: chapters/descriptor_dynamic_offset.adoc
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ ifndef::images[:images: images/]
7
7
[[descriptor-dynamic-offset]]
8
8
= Descriptor Dynamic Offset
9
9
10
-
Vulkan offers two types of descriptors that allow adjusting the offset at bind time as link:https://registry.khronos.org/vulkan/specs/1.3/html/vkspec.html#descriptorsets-binding-dynamicoffsets[defined in the spec].
10
+
Vulkan offers two types of descriptors that allow adjusting the offset at bind time as link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#descriptorsets-binding-dynamicoffsets[defined in the spec].
When the `VkPipeline` uses link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#pipelines-dynamic-state[dynamic state], some pipeline information can be omitted at creation time and instead set during recording of the command buffer. The new logical flow is:
41
+
When the `VkPipeline` uses link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#pipelines-dynamic-state[dynamic state], some pipeline information can be omitted at creation time and instead set during recording of the command buffer. The new logical flow is:
42
42
43
43
[source,cpp]
44
44
----
@@ -87,7 +87,7 @@ Some implementations might have a performance loss using some certain `VkDynamic
87
87
[[dynamic-state-lifetime]]
88
88
== Dynamic state lifetime
89
89
90
-
The spec talks about how there is a link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#dynamic-state-lifetime[dynamic state lifetime]. The following best describes it in some examples:
90
+
The spec talks about how there is a link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#dynamic-state-lifetime[dynamic state lifetime]. The following best describes it in some examples:
91
91
92
92
[source,cpp]
93
93
----
@@ -130,6 +130,6 @@ vkCmdDraw()
130
130
[[states-that-are-dynamic]]
131
131
== What states are dynamic
132
132
133
-
The full list of possible dynamic states can be found in link:https://registry.khronos.org/vulkan/specs/1.3-extensions/html/vkspec.html#VkDynamicState[VkDynamicState].
133
+
The full list of possible dynamic states can be found in link:https://registry.khronos.org/vulkan/specs/latest/html/vkspec.html#VkDynamicState[VkDynamicState].
134
134
135
135
The `VK_EXT_extended_dynamic_state`, `VK_EXT_extended_dynamic_state2`, `VK_EXT_extended_dynamic_state3`, `VK_EXT_vertex_input_dynamic_state`, `VK_EXT_attachment_feedback_loop_dynamic_state` and `VK_EXT_color_write_enable` extensions were added with the goal to support applications that need to reduce the number of pipeline state objects they compile and bind.
0 commit comments