1e5c31af7Sopenharmony_ci// Copyright 2015-2021 The Khronos Group, Inc.
2e5c31af7Sopenharmony_ci//
3e5c31af7Sopenharmony_ci// SPDX-License-Identifier: CC-BY-4.0
4e5c31af7Sopenharmony_ci
5e5c31af7Sopenharmony_ci[[vertexpostproc]]
6e5c31af7Sopenharmony_ci= Fixed-Function Vertex Post-Processing
7e5c31af7Sopenharmony_ci
8e5c31af7Sopenharmony_ciAfter <<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
9e5c31af7Sopenharmony_cistages>>, the following fixed-function operations are applied to vertices of
10e5c31af7Sopenharmony_cithe resulting primitives:
11e5c31af7Sopenharmony_ci
12e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[]
13e5c31af7Sopenharmony_ci  * Transform feedback (see <<vertexpostproc-transform-feedback,Transform
14e5c31af7Sopenharmony_ci    Feedback>>)
15e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[]
16e5c31af7Sopenharmony_ciifdef::VK_NV_viewport_swizzle[]
17e5c31af7Sopenharmony_ci  * Viewport swizzle (see <<vertexpostproc-viewport-swizzle,Viewport
18e5c31af7Sopenharmony_ci    Swizzle>>)
19e5c31af7Sopenharmony_ciendif::VK_NV_viewport_swizzle[]
20e5c31af7Sopenharmony_ci  * Flat shading (see <<vertexpostproc-flatshading>>).
21e5c31af7Sopenharmony_ci  * Primitive clipping, including client-defined half-spaces (see
22e5c31af7Sopenharmony_ci    <<vertexpostproc-clipping,Primitive Clipping>>).
23e5c31af7Sopenharmony_ci  * Shader output attribute clipping (see
24e5c31af7Sopenharmony_ci    <<vertexpostproc-clipping-shader-outputs,Clipping Shader Outputs>>).
25e5c31af7Sopenharmony_ciifdef::VK_NV_clip_space_w_scaling[]
26e5c31af7Sopenharmony_ci  * Clip space W scaling (see <<vertexpostproc-viewportwscaling,Controlling
27e5c31af7Sopenharmony_ci    Viewport W Scaling>>).
28e5c31af7Sopenharmony_ciendif::VK_NV_clip_space_w_scaling[]
29e5c31af7Sopenharmony_ci  * Perspective division on clip coordinates (see
30e5c31af7Sopenharmony_ci    <<vertexpostproc-coord-transform,Coordinate Transformations>>).
31e5c31af7Sopenharmony_ci  * Viewport mapping, including depth range scaling (see
32e5c31af7Sopenharmony_ci    <<vertexpostproc-viewport,Controlling the Viewport>>).
33e5c31af7Sopenharmony_ci  * Front face determination for polygon primitives (see
34e5c31af7Sopenharmony_ci    <<primsrast-polygons-basic,Basic Polygon Rasterization>>).
35e5c31af7Sopenharmony_ci
36e5c31af7Sopenharmony_ciifdef::editing-notes[]
37e5c31af7Sopenharmony_ci[NOTE]
38e5c31af7Sopenharmony_ci.editing-note
39e5c31af7Sopenharmony_ci====
40e5c31af7Sopenharmony_ciTODO:Odd that this one link to a different chapter is in this list.
41e5c31af7Sopenharmony_ci====
42e5c31af7Sopenharmony_ciendif::editing-notes[]
43e5c31af7Sopenharmony_ci
44e5c31af7Sopenharmony_ciNext, rasterization is performed on primitives as described in chapter
45e5c31af7Sopenharmony_ci<<primsrast,Rasterization>>.
46e5c31af7Sopenharmony_ci
47e5c31af7Sopenharmony_ci
48e5c31af7Sopenharmony_ciifdef::VK_EXT_transform_feedback[]
49e5c31af7Sopenharmony_ci[[vertexpostproc-transform-feedback]]
50e5c31af7Sopenharmony_ci== Transform Feedback
51e5c31af7Sopenharmony_ci
52e5c31af7Sopenharmony_ciBefore any other fixed-function vertex post-processing, vertex outputs from
53e5c31af7Sopenharmony_cithe last shader in the
54e5c31af7Sopenharmony_ci<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
55e5c31af7Sopenharmony_cistage>> can: be written out to one or more transform feedback buffers bound
56e5c31af7Sopenharmony_cito the command buffer.
57e5c31af7Sopenharmony_ciTo capture vertex outputs the last
58e5c31af7Sopenharmony_ci<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
59e5c31af7Sopenharmony_cistage>> shader must: be declared with the code:Xfb execution mode.
60e5c31af7Sopenharmony_ciOutputs decorated with code:XfbBuffer will be written out to the
61e5c31af7Sopenharmony_cicorresponding transform feedback buffers bound to the command buffer when
62e5c31af7Sopenharmony_citransform feedback is active.
63e5c31af7Sopenharmony_ciTransform feedback buffers are bound to the command buffer by using
64e5c31af7Sopenharmony_ciflink:vkCmdBindTransformFeedbackBuffersEXT.
65e5c31af7Sopenharmony_ciTransform feedback is made active by calling
66e5c31af7Sopenharmony_ciflink:vkCmdBeginTransformFeedbackEXT and made inactive by calling
67e5c31af7Sopenharmony_ciflink:vkCmdEndTransformFeedbackEXT.
68e5c31af7Sopenharmony_ciAfter vertex data is written it is possible to use
69e5c31af7Sopenharmony_ciflink:vkCmdDrawIndirectByteCountEXT to start a new draw where the
70e5c31af7Sopenharmony_cipname:vertexCount is derived from the number of bytes written by a previous
71e5c31af7Sopenharmony_citransform feedback.
72e5c31af7Sopenharmony_ci
73e5c31af7Sopenharmony_ciWhen an individual point, line, or triangle primitive reaches the transform
74e5c31af7Sopenharmony_cifeedback stage while transform feedback is active, the values of the
75e5c31af7Sopenharmony_cispecified output variables are assembled into primitives and appended to the
76e5c31af7Sopenharmony_cibound transform feedback buffers.
77e5c31af7Sopenharmony_ciAfter activating transform feedback, the values of the first assembled
78e5c31af7Sopenharmony_ciprimitive are written at the starting offsets of the bound transform
79e5c31af7Sopenharmony_cifeedback buffers, and subsequent primitives are appended to the buffer.
80e5c31af7Sopenharmony_ciIf the optional pname:pCounterBuffers and pname:pCounterBufferOffsets
81e5c31af7Sopenharmony_ciparameters are specified, the starting points within the transform feedback
82e5c31af7Sopenharmony_cibuffers are adjusted so data is appended to the previously written values
83e5c31af7Sopenharmony_ciindicated by the value stored by the implementation in the counter buffer.
84e5c31af7Sopenharmony_ci
85e5c31af7Sopenharmony_ciFor multi-vertex primitives, all values for a given vertex are written
86e5c31af7Sopenharmony_cibefore writing values for any other vertex.
87e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
88e5c31af7Sopenharmony_ciWhen
89e5c31af7Sopenharmony_ci<<features-transformFeedbackPreservesProvokingVertex,transformFeedbackPreservesProvokingVertex>>
90e5c31af7Sopenharmony_ciis not enabled, implementations
91e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
92e5c31af7Sopenharmony_ciifndef::VK_EXT_provoking_vertex[]
93e5c31af7Sopenharmony_ciImplementations
94e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
95e5c31af7Sopenharmony_cimay: write out any vertex within the primitive first, but all subsequent
96e5c31af7Sopenharmony_civertices for that primitive must: be written out in a consistent winding
97e5c31af7Sopenharmony_ciorder defined as follows:
98e5c31af7Sopenharmony_ci
99e5c31af7Sopenharmony_ci  * If neither <<geometry,geometry>> or <<tessellation,tessellation
100e5c31af7Sopenharmony_ci    shading>> is active, vertices within a primitive are appended according
101e5c31af7Sopenharmony_ci    to the winding order described by the <<drawing-primitive-topologies,
102e5c31af7Sopenharmony_ci    primitive topology>> defined by the
103e5c31af7Sopenharmony_ci    slink:VkPipelineInputAssemblyStateCreateInfo:pname:topology used to
104e5c31af7Sopenharmony_ci    execute the <<drawing,drawing command>>.
105e5c31af7Sopenharmony_ci  * If <<geometry,geometry shading>> is active, vertices within a primitive
106e5c31af7Sopenharmony_ci    are appended according to the winding order described by the
107e5c31af7Sopenharmony_ci    <<drawing-primitive-topologies, primitive topology>> defined by the
108e5c31af7Sopenharmony_ci    <<drawing-point-lists, code:OutputPoints>>, <<drawing-line-strips,
109e5c31af7Sopenharmony_ci    code:OutputLineStrips>>, or <<drawing-triangle-strips,
110e5c31af7Sopenharmony_ci    code:OutputTriangleStrips>> execution mode.
111e5c31af7Sopenharmony_ci  * If <<tessellation,tessellation shading>> is active but
112e5c31af7Sopenharmony_ci    <<geometry,geometry shading>> is not, vertices within a primitive are
113e5c31af7Sopenharmony_ci    appended according to the winding order defined by
114e5c31af7Sopenharmony_ci    <<tessellation-triangle-tessellation, triangle tessellation>>,
115e5c31af7Sopenharmony_ci    <<tessellation-quad-tessellation, quad tessellation>>, and
116e5c31af7Sopenharmony_ci    <<tessellation-isoline-tessellation, isoline tessellation>>.
117e5c31af7Sopenharmony_ci
118e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
119e5c31af7Sopenharmony_ciWhen
120e5c31af7Sopenharmony_ci<<features-transformFeedbackPreservesProvokingVertex,transformFeedbackPreservesProvokingVertex>>
121e5c31af7Sopenharmony_ciis enabled, then in addition to writing vertices with a consistent winding
122e5c31af7Sopenharmony_ciorder, the vertex order must: preserve the <<vertexpostproc-flatshading,
123e5c31af7Sopenharmony_ciprovoking vertex>> of each primitive:
124e5c31af7Sopenharmony_ci
125e5c31af7Sopenharmony_ci  * When the
126e5c31af7Sopenharmony_ci    <<VkPipelineRasterizationProvokingVertexStateCreateInfoEXT,pipeline's
127e5c31af7Sopenharmony_ci    provoking vertex mode>> is
128e5c31af7Sopenharmony_ci    ename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the primitive's
129e5c31af7Sopenharmony_ci    provoking vertex must be the first vertex written.
130e5c31af7Sopenharmony_ci  * When the
131e5c31af7Sopenharmony_ci    <<VkPipelineRasterizationProvokingVertexStateCreateInfoEXT,pipeline's
132e5c31af7Sopenharmony_ci    provoking vertex mode>> is
133e5c31af7Sopenharmony_ci    ename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the primitive's
134e5c31af7Sopenharmony_ci    provoking vertex must be the last vertex written.
135e5c31af7Sopenharmony_ci
136e5c31af7Sopenharmony_ciIf
137e5c31af7Sopenharmony_ci<<limits-transformFeedbackPreservesTriangleFanProvokingVertex,pname:transformFeedbackPreservesTriangleFanProvokingVertex>>
138e5c31af7Sopenharmony_ciis ename:VK_FALSE, neither <<geometry,geometry>> nor
139e5c31af7Sopenharmony_ci<<tessellation,tessellation>> shading is active, and the
140e5c31af7Sopenharmony_ci<<drawing-primitive-topologies,primitive topology>> is
141e5c31af7Sopenharmony_ciename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN, then the first vertex written from
142e5c31af7Sopenharmony_cieach primitive is implementation-defined even when
143e5c31af7Sopenharmony_ci<<features-transformFeedbackPreservesProvokingVertex,transformFeedbackPreservesProvokingVertex>>
144e5c31af7Sopenharmony_ciis enabled.
145e5c31af7Sopenharmony_ci
146e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
147e5c31af7Sopenharmony_ci
148e5c31af7Sopenharmony_ciWhen capturing vertices, the stride associated with each transform feedback
149e5c31af7Sopenharmony_cibuffer, as indicated by the code:XfbStride decoration, indicates the number
150e5c31af7Sopenharmony_ciof bytes of storage reserved for each vertex in the transform feedback
151e5c31af7Sopenharmony_cibuffer.
152e5c31af7Sopenharmony_ciFor every vertex captured, each output attribute with a code:Offset
153e5c31af7Sopenharmony_cidecoration will be written to the storage reserved for the vertex at the
154e5c31af7Sopenharmony_ciassociated transform feedback buffer.
155e5c31af7Sopenharmony_ciWhen writing output variables that are arrays or structures, individual
156e5c31af7Sopenharmony_ciarray elements or structure members are written tightly packed in order.
157e5c31af7Sopenharmony_ciFor vector types, individual components are written in order.
158e5c31af7Sopenharmony_ciFor matrix types, outputs are written as an array of column vectors.
159e5c31af7Sopenharmony_ci
160e5c31af7Sopenharmony_ciIf any component of an output with an assigned transform feedback offset was
161e5c31af7Sopenharmony_cinot written to by its shader, the value recorded for that component is
162e5c31af7Sopenharmony_ciundefined:.
163e5c31af7Sopenharmony_ciAll components of an output variable must: be written at an offset aligned
164e5c31af7Sopenharmony_cito the size of the component.
165e5c31af7Sopenharmony_ciThe size of each component of an output variable must: be at least 32-bits.
166e5c31af7Sopenharmony_ciWhen capturing a vertex, any portion of the reserved storage not associated
167e5c31af7Sopenharmony_ciwith an output variable with an assigned transform feedback offset will be
168e5c31af7Sopenharmony_ciunmodified.
169e5c31af7Sopenharmony_ci
170e5c31af7Sopenharmony_ciWhen transform feedback is inactive, no vertices are recorded.
171e5c31af7Sopenharmony_ciIf there is a valid counter buffer handle and counter buffer offset in the
172e5c31af7Sopenharmony_cipname:pCounterBuffers and pname:pCounterBufferOffsets arrays, writes to the
173e5c31af7Sopenharmony_cicorresponding transform feedback buffer will start at the byte offset
174e5c31af7Sopenharmony_cirepresented by the value stored in the counter buffer location.
175e5c31af7Sopenharmony_ci
176e5c31af7Sopenharmony_ciIndividual lines or triangles of a strip or fan primitive will be extracted
177e5c31af7Sopenharmony_ciand recorded separately.
178e5c31af7Sopenharmony_ciIncomplete primitives are not recorded.
179e5c31af7Sopenharmony_ci
180e5c31af7Sopenharmony_ciWhen using a geometry shader that emits vertices to multiple vertex streams,
181e5c31af7Sopenharmony_cia primitive will be assembled and output for each stream when there are
182e5c31af7Sopenharmony_cienough vertices emitted for the output primitive type.
183e5c31af7Sopenharmony_ciAll outputs assigned to a given transform feedback buffer are required to
184e5c31af7Sopenharmony_cicome from a single vertex stream.
185e5c31af7Sopenharmony_ci
186e5c31af7Sopenharmony_ciThe sizes of the transform feedback buffers are defined by the
187e5c31af7Sopenharmony_ciflink:vkCmdBindTransformFeedbackBuffersEXT pname:pSizes parameter for each
188e5c31af7Sopenharmony_ciof the bound buffers, or the size of the bound buffer, whichever is the
189e5c31af7Sopenharmony_cilesser.
190e5c31af7Sopenharmony_ciIf there is less space remaining in any of the transform feedback buffers
191e5c31af7Sopenharmony_cithan the size of all of the vertex data for that primitive based on the
192e5c31af7Sopenharmony_cicode:XfbStride for that code:XfbBuffer then no vertex data of that primitive
193e5c31af7Sopenharmony_ciis recorded in any transform feedback buffer, and the value for the number
194e5c31af7Sopenharmony_ciof primitives written in the corresponding
195e5c31af7Sopenharmony_ciename:VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT query for all transform
196e5c31af7Sopenharmony_cifeedback buffers is no longer incremented.
197e5c31af7Sopenharmony_ci
198e5c31af7Sopenharmony_ciAny outputs made to a code:XfbBuffer that is not bound to a transform
199e5c31af7Sopenharmony_cifeedback buffer is ignored.
200e5c31af7Sopenharmony_ci
201e5c31af7Sopenharmony_ci[open,refpage='vkCmdBindTransformFeedbackBuffersEXT',desc='Bind transform feedback buffers to a command buffer',type='protos']
202e5c31af7Sopenharmony_ci--
203e5c31af7Sopenharmony_ciTo bind transform feedback buffers to a command buffer for use in subsequent
204e5c31af7Sopenharmony_cidrawing commands, call:
205e5c31af7Sopenharmony_ci
206e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBindTransformFeedbackBuffersEXT.txt[]
207e5c31af7Sopenharmony_ci
208e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
209e5c31af7Sopenharmony_ci    recorded.
210e5c31af7Sopenharmony_ci  * pname:firstBinding is the index of the first transform feedback binding
211e5c31af7Sopenharmony_ci    whose state is updated by the command.
212e5c31af7Sopenharmony_ci  * pname:bindingCount is the number of transform feedback bindings whose
213e5c31af7Sopenharmony_ci    state is updated by the command.
214e5c31af7Sopenharmony_ci  * pname:pBuffers is a pointer to an array of buffer handles.
215e5c31af7Sopenharmony_ci  * pname:pOffsets is a pointer to an array of buffer offsets.
216e5c31af7Sopenharmony_ci  * pname:pSizes is `NULL` or a pointer to an array of basetype:VkDeviceSize
217e5c31af7Sopenharmony_ci    buffer sizes, specifying the maximum number of bytes to capture to the
218e5c31af7Sopenharmony_ci    corresponding transform feedback buffer.
219e5c31af7Sopenharmony_ci    If pname:pSizes is `NULL`, or the value of the pname:pSizes array
220e5c31af7Sopenharmony_ci    element is ename:VK_WHOLE_SIZE, then the maximum number of bytes
221e5c31af7Sopenharmony_ci    captured will be the size of the corresponding buffer minus the buffer
222e5c31af7Sopenharmony_ci    offset.
223e5c31af7Sopenharmony_ci
224e5c31af7Sopenharmony_ciThe values taken from elements [eq]#i# of pname:pBuffers, pname:pOffsets and
225e5c31af7Sopenharmony_cipname:pSizes replace the current state for the transform feedback binding
226e5c31af7Sopenharmony_ci[eq]#pname:firstBinding {plus} i#, for [eq]#i# in [eq]#[0,
227e5c31af7Sopenharmony_cipname:bindingCount)#.
228e5c31af7Sopenharmony_ciThe transform feedback binding is updated to start at the offset indicated
229e5c31af7Sopenharmony_ciby pname:pOffsets[i] from the start of the buffer pname:pBuffers[i].
230e5c31af7Sopenharmony_ci
231e5c31af7Sopenharmony_ci.Valid Usage
232e5c31af7Sopenharmony_ci****
233e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-transformFeedback-02355]]
234e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackFeaturesEXT::pname:transformFeedback
235e5c31af7Sopenharmony_ci    must: be enabled
236e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-firstBinding-02356]]
237e5c31af7Sopenharmony_ci    pname:firstBinding must: be less than
238e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBuffers
239e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-firstBinding-02357]]
240e5c31af7Sopenharmony_ci    The sum of pname:firstBinding and pname:bindingCount must: be less than
241e5c31af7Sopenharmony_ci    or equal to
242e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBuffers
243e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-pOffsets-02358]]
244e5c31af7Sopenharmony_ci    All elements of pname:pOffsets must: be less than the size of the
245e5c31af7Sopenharmony_ci    corresponding element in pname:pBuffers
246e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-pOffsets-02359]]
247e5c31af7Sopenharmony_ci    All elements of pname:pOffsets must: be a multiple of 4
248e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-pBuffers-02360]]
249e5c31af7Sopenharmony_ci    All elements of pname:pBuffers must: have been created with the
250e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT flag
251e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-pSize-02361]]
252e5c31af7Sopenharmony_ci    If the optional pname:pSize array is specified, each element of
253e5c31af7Sopenharmony_ci    pname:pSizes must: either be ename:VK_WHOLE_SIZE, or be less than or
254e5c31af7Sopenharmony_ci    equal to
255e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBufferSize
256e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-pSizes-02362]]
257e5c31af7Sopenharmony_ci    All elements of pname:pSizes must: be either ename:VK_WHOLE_SIZE, or
258e5c31af7Sopenharmony_ci    less than or equal to the size of the corresponding buffer in
259e5c31af7Sopenharmony_ci    pname:pBuffers
260e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-pOffsets-02363]]
261e5c31af7Sopenharmony_ci    All elements of pname:pOffsets plus pname:pSizes, where the
262e5c31af7Sopenharmony_ci    pname:pSizes, element is not ename:VK_WHOLE_SIZE, must: be less than or
263e5c31af7Sopenharmony_ci    equal to the size of the corresponding buffer in pname:pBuffers
264e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-pBuffers-02364]]
265e5c31af7Sopenharmony_ci    Each element of pname:pBuffers that is non-sparse must: be bound
266e5c31af7Sopenharmony_ci    completely and contiguously to a single sname:VkDeviceMemory object
267e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBindTransformFeedbackBuffersEXT-None-02365]]
268e5c31af7Sopenharmony_ci    Transform feedback must: not be active when the
269e5c31af7Sopenharmony_ci    fname:vkCmdBindTransformFeedbackBuffersEXT command is recorded
270e5c31af7Sopenharmony_ci****
271e5c31af7Sopenharmony_ci
272e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBindTransformFeedbackBuffersEXT.txt[]
273e5c31af7Sopenharmony_ci--
274e5c31af7Sopenharmony_ci
275e5c31af7Sopenharmony_ci[open,refpage='vkCmdBeginTransformFeedbackEXT',desc='Make transform feedback active in the command buffer',type='protos']
276e5c31af7Sopenharmony_ci--
277e5c31af7Sopenharmony_ciTransform feedback for specific transform feedback buffers is made active by
278e5c31af7Sopenharmony_cicalling:
279e5c31af7Sopenharmony_ci
280e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdBeginTransformFeedbackEXT.txt[]
281e5c31af7Sopenharmony_ci
282e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
283e5c31af7Sopenharmony_ci    recorded.
284e5c31af7Sopenharmony_ci  * pname:firstCounterBuffer is the index of the first transform feedback
285e5c31af7Sopenharmony_ci    buffer corresponding to pname:pCounterBuffers[0] and
286e5c31af7Sopenharmony_ci    pname:pCounterBufferOffsets[0].
287e5c31af7Sopenharmony_ci  * pname:counterBufferCount is the size of the pname:pCounterBuffers and
288e5c31af7Sopenharmony_ci    pname:pCounterBufferOffsets arrays.
289e5c31af7Sopenharmony_ci  * pname:pCounterBuffers is `NULL` or a pointer to an array of
290e5c31af7Sopenharmony_ci    slink:VkBuffer handles to counter buffers.
291e5c31af7Sopenharmony_ci    Each buffer contains a 4 byte integer value representing the byte offset
292e5c31af7Sopenharmony_ci    from the start of the corresponding transform feedback buffer from where
293e5c31af7Sopenharmony_ci    to start capturing vertex data.
294e5c31af7Sopenharmony_ci    If the byte offset stored to the counter buffer location was done using
295e5c31af7Sopenharmony_ci    flink:vkCmdEndTransformFeedbackEXT it can be used to resume transform
296e5c31af7Sopenharmony_ci    feedback from the previous location.
297e5c31af7Sopenharmony_ci    If pname:pCounterBuffers is `NULL`, then transform feedback will start
298e5c31af7Sopenharmony_ci    capturing vertex data to byte offset zero in all bound transform
299e5c31af7Sopenharmony_ci    feedback buffers.
300e5c31af7Sopenharmony_ci    For each element of pname:pCounterBuffers that is dlink:VK_NULL_HANDLE,
301e5c31af7Sopenharmony_ci    transform feedback will start capturing vertex data to byte zero in the
302e5c31af7Sopenharmony_ci    corresponding bound transform feedback buffer.
303e5c31af7Sopenharmony_ci  * pname:pCounterBufferOffsets is `NULL` or a pointer to an array of
304e5c31af7Sopenharmony_ci    basetype:VkDeviceSize values specifying offsets within each of the
305e5c31af7Sopenharmony_ci    pname:pCounterBuffers where the counter values were previously written.
306e5c31af7Sopenharmony_ci    The location in each counter buffer at these offsets must: be large
307e5c31af7Sopenharmony_ci    enough to contain 4 bytes of data.
308e5c31af7Sopenharmony_ci    This data is the number of bytes captured by the previous transform
309e5c31af7Sopenharmony_ci    feedback to this buffer.
310e5c31af7Sopenharmony_ci    If pname:pCounterBufferOffsets is `NULL`, then it is assumed the offsets
311e5c31af7Sopenharmony_ci    are zero.
312e5c31af7Sopenharmony_ci
313e5c31af7Sopenharmony_ciThe active transform feedback buffers will capture primitives emitted from
314e5c31af7Sopenharmony_cithe corresponding code:XfbBuffer in the bound graphics pipeline.
315e5c31af7Sopenharmony_ciAny code:XfbBuffer emitted that does not output to an active transform
316e5c31af7Sopenharmony_cifeedback buffer will not be captured.
317e5c31af7Sopenharmony_ci
318e5c31af7Sopenharmony_ci.Valid Usage
319e5c31af7Sopenharmony_ci****
320e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-transformFeedback-02366]]
321e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackFeaturesEXT::pname:transformFeedback
322e5c31af7Sopenharmony_ci    must: be enabled
323e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-None-02367]]
324e5c31af7Sopenharmony_ci    Transform feedback must: not be active
325e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-firstCounterBuffer-02368]]
326e5c31af7Sopenharmony_ci    pname:firstCounterBuffer must: be less than
327e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBuffers
328e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-firstCounterBuffer-02369]]
329e5c31af7Sopenharmony_ci    The sum of pname:firstCounterBuffer and pname:counterBufferCount must:
330e5c31af7Sopenharmony_ci    be less than or equal to
331e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBuffers
332e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-counterBufferCount-02607]]
333e5c31af7Sopenharmony_ci    If pname:counterBufferCount is not `0`, and pname:pCounterBuffers is not
334e5c31af7Sopenharmony_ci    `NULL`, pname:pCounterBuffers must: be a valid pointer to an array of
335e5c31af7Sopenharmony_ci    pname:counterBufferCount sname:VkBuffer handles that are either valid or
336e5c31af7Sopenharmony_ci    dlink:VK_NULL_HANDLE
337e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-pCounterBufferOffsets-02370]]
338e5c31af7Sopenharmony_ci    For each buffer handle in the array, if it is not dlink:VK_NULL_HANDLE
339e5c31af7Sopenharmony_ci    it must: reference a buffer large enough to hold 4 bytes at the
340e5c31af7Sopenharmony_ci    corresponding offset from the pname:pCounterBufferOffsets array
341e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-pCounterBuffer-02371]]
342e5c31af7Sopenharmony_ci    If pname:pCounterBuffer is `NULL`, then pname:pCounterBufferOffsets
343e5c31af7Sopenharmony_ci    must: also be `NULL`
344e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-pCounterBuffers-02372]]
345e5c31af7Sopenharmony_ci    For each buffer handle in the pname:pCounterBuffers array that is not
346e5c31af7Sopenharmony_ci    dlink:VK_NULL_HANDLE it must: have been created with a pname:usage value
347e5c31af7Sopenharmony_ci    containing
348e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT
349e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-None-06233]]
350e5c31af7Sopenharmony_ci    A valid graphics pipeline must: be bound to
351e5c31af7Sopenharmony_ci    ename:VK_PIPELINE_BIND_POINT_GRAPHICS
352e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-None-04128]]
353e5c31af7Sopenharmony_ci    The last <<pipeline-graphics-subsets-pre-rasterization,pre-rasterization
354e5c31af7Sopenharmony_ci    shader stage>> of the bound graphics pipeline must: have been declared
355e5c31af7Sopenharmony_ci    with the code:Xfb execution mode
356e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_multiview[]
357e5c31af7Sopenharmony_ci  * [[VUID-vkCmdBeginTransformFeedbackEXT-None-02373]]
358e5c31af7Sopenharmony_ci    Transform feedback must: not be made active in a render pass instance
359e5c31af7Sopenharmony_ci    with multiview enabled
360e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_multiview[]
361e5c31af7Sopenharmony_ci****
362e5c31af7Sopenharmony_ci
363e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdBeginTransformFeedbackEXT.txt[]
364e5c31af7Sopenharmony_ci--
365e5c31af7Sopenharmony_ci
366e5c31af7Sopenharmony_ci[open,refpage='vkCmdEndTransformFeedbackEXT',desc='Make transform feedback inactive in the command buffer',type='protos']
367e5c31af7Sopenharmony_ci--
368e5c31af7Sopenharmony_ciTransform feedback for specific transform feedback buffers is made inactive
369e5c31af7Sopenharmony_ciby calling:
370e5c31af7Sopenharmony_ci
371e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdEndTransformFeedbackEXT.txt[]
372e5c31af7Sopenharmony_ci
373e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command is
374e5c31af7Sopenharmony_ci    recorded.
375e5c31af7Sopenharmony_ci  * pname:firstCounterBuffer is the index of the first transform feedback
376e5c31af7Sopenharmony_ci    buffer corresponding to pname:pCounterBuffers[0] and
377e5c31af7Sopenharmony_ci    pname:pCounterBufferOffsets[0].
378e5c31af7Sopenharmony_ci  * pname:counterBufferCount is the size of the pname:pCounterBuffers and
379e5c31af7Sopenharmony_ci    pname:pCounterBufferOffsets arrays.
380e5c31af7Sopenharmony_ci  * pname:pCounterBuffers is `NULL` or a pointer to an array of
381e5c31af7Sopenharmony_ci    slink:VkBuffer handles to counter buffers.
382e5c31af7Sopenharmony_ci    The counter buffers are used to record the current byte positions of
383e5c31af7Sopenharmony_ci    each transform feedback buffer where the next vertex output data would
384e5c31af7Sopenharmony_ci    be captured.
385e5c31af7Sopenharmony_ci    This can: be used by a subsequent flink:vkCmdBeginTransformFeedbackEXT
386e5c31af7Sopenharmony_ci    call to resume transform feedback capture from this position.
387e5c31af7Sopenharmony_ci    It can also be used by flink:vkCmdDrawIndirectByteCountEXT to determine
388e5c31af7Sopenharmony_ci    the vertex count of the draw call.
389e5c31af7Sopenharmony_ci  * pname:pCounterBufferOffsets is `NULL` or a pointer to an array of
390e5c31af7Sopenharmony_ci    basetype:VkDeviceSize values specifying offsets within each of the
391e5c31af7Sopenharmony_ci    pname:pCounterBuffers where the counter values can be written.
392e5c31af7Sopenharmony_ci    The location in each counter buffer at these offsets must: be large
393e5c31af7Sopenharmony_ci    enough to contain 4 bytes of data.
394e5c31af7Sopenharmony_ci    The data stored at this location is the byte offset from the start of
395e5c31af7Sopenharmony_ci    the transform feedback buffer binding where the next vertex data would
396e5c31af7Sopenharmony_ci    be written.
397e5c31af7Sopenharmony_ci    If pname:pCounterBufferOffsets is `NULL`, then it is assumed the offsets
398e5c31af7Sopenharmony_ci    are zero.
399e5c31af7Sopenharmony_ci
400e5c31af7Sopenharmony_ci.Valid Usage
401e5c31af7Sopenharmony_ci****
402e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndTransformFeedbackEXT-transformFeedback-02374]]
403e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackFeaturesEXT::pname:transformFeedback
404e5c31af7Sopenharmony_ci    must: be enabled
405e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndTransformFeedbackEXT-None-02375]]
406e5c31af7Sopenharmony_ci    Transform feedback must: be active
407e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndTransformFeedbackEXT-firstCounterBuffer-02376]]
408e5c31af7Sopenharmony_ci    pname:firstCounterBuffer must: be less than
409e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBuffers
410e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndTransformFeedbackEXT-firstCounterBuffer-02377]]
411e5c31af7Sopenharmony_ci    The sum of pname:firstCounterBuffer and pname:counterBufferCount must:
412e5c31af7Sopenharmony_ci    be less than or equal to
413e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceTransformFeedbackPropertiesEXT::pname:maxTransformFeedbackBuffers
414e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndTransformFeedbackEXT-counterBufferCount-02608]]
415e5c31af7Sopenharmony_ci    If pname:counterBufferCount is not `0`, and pname:pCounterBuffers is not
416e5c31af7Sopenharmony_ci    `NULL`, pname:pCounterBuffers must: be a valid pointer to an array of
417e5c31af7Sopenharmony_ci    pname:counterBufferCount sname:VkBuffer handles that are either valid or
418e5c31af7Sopenharmony_ci    dlink:VK_NULL_HANDLE
419e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndTransformFeedbackEXT-pCounterBufferOffsets-02378]]
420e5c31af7Sopenharmony_ci    For each buffer handle in the array, if it is not dlink:VK_NULL_HANDLE
421e5c31af7Sopenharmony_ci    it must: reference a buffer large enough to hold 4 bytes at the
422e5c31af7Sopenharmony_ci    corresponding offset from the pname:pCounterBufferOffsets array
423e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndTransformFeedbackEXT-pCounterBuffer-02379]]
424e5c31af7Sopenharmony_ci    If pname:pCounterBuffer is `NULL`, then pname:pCounterBufferOffsets
425e5c31af7Sopenharmony_ci    must: also be `NULL`
426e5c31af7Sopenharmony_ci  * [[VUID-vkCmdEndTransformFeedbackEXT-pCounterBuffers-02380]]
427e5c31af7Sopenharmony_ci    For each buffer handle in the pname:pCounterBuffers array that is not
428e5c31af7Sopenharmony_ci    dlink:VK_NULL_HANDLE it must: have been created with a pname:usage value
429e5c31af7Sopenharmony_ci    containing
430e5c31af7Sopenharmony_ci    ename:VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT
431e5c31af7Sopenharmony_ci****
432e5c31af7Sopenharmony_ci
433e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdEndTransformFeedbackEXT.txt[]
434e5c31af7Sopenharmony_ci--
435e5c31af7Sopenharmony_ciendif::VK_EXT_transform_feedback[]
436e5c31af7Sopenharmony_ci
437e5c31af7Sopenharmony_ci
438e5c31af7Sopenharmony_ciifdef::VK_NV_viewport_swizzle[]
439e5c31af7Sopenharmony_ci[[vertexpostproc-viewport-swizzle]]
440e5c31af7Sopenharmony_ci== Viewport Swizzle
441e5c31af7Sopenharmony_ci
442e5c31af7Sopenharmony_ci[open,refpage='VkPipelineViewportSwizzleStateCreateInfoNV',desc='Structure specifying swizzle applied to primitive clip coordinates',type='structs']
443e5c31af7Sopenharmony_ci--
444e5c31af7Sopenharmony_ciEach primitive sent to a given viewport has a swizzle and optional: negation
445e5c31af7Sopenharmony_ciapplied to its clip coordinates.
446e5c31af7Sopenharmony_ciThe swizzle that is applied depends on the viewport index, and is controlled
447e5c31af7Sopenharmony_ciby the sname:VkPipelineViewportSwizzleStateCreateInfoNV pipeline state:
448e5c31af7Sopenharmony_ci
449e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineViewportSwizzleStateCreateInfoNV.txt[]
450e5c31af7Sopenharmony_ci
451e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
452e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
453e5c31af7Sopenharmony_ci    structure.
454e5c31af7Sopenharmony_ci  * pname:flags is reserved for future use.
455e5c31af7Sopenharmony_ci  * pname:viewportCount is the number of viewport swizzles used by the
456e5c31af7Sopenharmony_ci    pipeline.
457e5c31af7Sopenharmony_ci  * pname:pViewportSwizzles is a pointer to an array of
458e5c31af7Sopenharmony_ci    slink:VkViewportSwizzleNV structures, defining the viewport swizzles.
459e5c31af7Sopenharmony_ci
460e5c31af7Sopenharmony_ci.Valid Usage
461e5c31af7Sopenharmony_ci****
462e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportSwizzleStateCreateInfoNV-viewportCount-01215]]
463e5c31af7Sopenharmony_ci    pname:viewportCount must: be greater than or equal to the
464e5c31af7Sopenharmony_ci    pname:viewportCount set in sname:VkPipelineViewportStateCreateInfo
465e5c31af7Sopenharmony_ci****
466e5c31af7Sopenharmony_ci
467e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineViewportSwizzleStateCreateInfoNV.txt[]
468e5c31af7Sopenharmony_ci--
469e5c31af7Sopenharmony_ci
470e5c31af7Sopenharmony_ci[open,refpage='VkPipelineViewportSwizzleStateCreateFlagsNV',desc='Reserved for future use',type='flags']
471e5c31af7Sopenharmony_ci--
472e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineViewportSwizzleStateCreateFlagsNV.txt[]
473e5c31af7Sopenharmony_ci
474e5c31af7Sopenharmony_citname:VkPipelineViewportSwizzleStateCreateFlagsNV is a bitmask type for
475e5c31af7Sopenharmony_cisetting a mask, but is currently reserved for future use.
476e5c31af7Sopenharmony_ci--
477e5c31af7Sopenharmony_ci
478e5c31af7Sopenharmony_ciThe sname:VkPipelineViewportSwizzleStateCreateInfoNV state is set by adding
479e5c31af7Sopenharmony_cithis structure to the pname:pNext chain of a
480e5c31af7Sopenharmony_cisname:VkPipelineViewportStateCreateInfo structure and setting the graphics
481e5c31af7Sopenharmony_cipipeline state with flink:vkCreateGraphicsPipelines.
482e5c31af7Sopenharmony_ci
483e5c31af7Sopenharmony_ciEach viewport specified from 0 to pname:viewportCount - 1 has its x,y,z,w
484e5c31af7Sopenharmony_ciswizzle state set to the corresponding pname:x, pname:y, pname:z and pname:w
485e5c31af7Sopenharmony_ciin the slink:VkViewportSwizzleNV structure.
486e5c31af7Sopenharmony_ciEach component is of type elink:VkViewportCoordinateSwizzleNV, which
487e5c31af7Sopenharmony_cidetermines the type of swizzle for that component.
488e5c31af7Sopenharmony_ciThe value of pname:x computes the new x component of the position as:
489e5c31af7Sopenharmony_ci
490e5c31af7Sopenharmony_ci[source,c]
491e5c31af7Sopenharmony_ci---------------------------------------------------
492e5c31af7Sopenharmony_ciif (x == VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV) x' = x;
493e5c31af7Sopenharmony_ciif (x == VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV) x' = -x;
494e5c31af7Sopenharmony_ciif (x == VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV) x' = y;
495e5c31af7Sopenharmony_ciif (x == VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV) x' = -y;
496e5c31af7Sopenharmony_ciif (x == VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV) x' = z;
497e5c31af7Sopenharmony_ciif (x == VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV) x' = -z;
498e5c31af7Sopenharmony_ciif (x == VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV) x' = w;
499e5c31af7Sopenharmony_ciif (x == VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV) x' = -w;
500e5c31af7Sopenharmony_ci---------------------------------------------------
501e5c31af7Sopenharmony_ci
502e5c31af7Sopenharmony_ciSimilar selections are performed for the pname:y, pname:z, and pname:w
503e5c31af7Sopenharmony_cicoordinates.
504e5c31af7Sopenharmony_ciThis swizzling is applied before clipping and perspective divide.
505e5c31af7Sopenharmony_ciIf the swizzle for an active viewport index is not specified, the swizzle
506e5c31af7Sopenharmony_cifor pname:x is ename:VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV, pname:y
507e5c31af7Sopenharmony_ciis ename:VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV, pname:z is
508e5c31af7Sopenharmony_ciename:VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV and pname:w is
509e5c31af7Sopenharmony_ciename:VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV.
510e5c31af7Sopenharmony_ci
511e5c31af7Sopenharmony_ciViewport swizzle parameters are specified by setting the pname:pNext pointer
512e5c31af7Sopenharmony_ciof sname:VkGraphicsPipelineCreateInfo to point to a
513e5c31af7Sopenharmony_cisname:VkPipelineViewportSwizzleStateCreateInfoNV structure.
514e5c31af7Sopenharmony_cislink:VkPipelineViewportSwizzleStateCreateInfoNV uses
515e5c31af7Sopenharmony_cisname:VkViewportSwizzleNV to set the viewport swizzle parameters.
516e5c31af7Sopenharmony_ci
517e5c31af7Sopenharmony_ci[open,refpage='VkViewportSwizzleNV',desc='Structure specifying a viewport swizzle',type='structs']
518e5c31af7Sopenharmony_ci--
519e5c31af7Sopenharmony_ciThe sname:VkViewportSwizzleNV structure is defined as:
520e5c31af7Sopenharmony_ci
521e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkViewportSwizzleNV.txt[]
522e5c31af7Sopenharmony_ci
523e5c31af7Sopenharmony_ci  * pname:x is a elink:VkViewportCoordinateSwizzleNV value specifying the
524e5c31af7Sopenharmony_ci    swizzle operation to apply to the x component of the primitive
525e5c31af7Sopenharmony_ci  * pname:y is a elink:VkViewportCoordinateSwizzleNV value specifying the
526e5c31af7Sopenharmony_ci    swizzle operation to apply to the y component of the primitive
527e5c31af7Sopenharmony_ci  * pname:z is a elink:VkViewportCoordinateSwizzleNV value specifying the
528e5c31af7Sopenharmony_ci    swizzle operation to apply to the z component of the primitive
529e5c31af7Sopenharmony_ci  * pname:w is a elink:VkViewportCoordinateSwizzleNV value specifying the
530e5c31af7Sopenharmony_ci    swizzle operation to apply to the w component of the primitive
531e5c31af7Sopenharmony_ci
532e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkViewportSwizzleNV.txt[]
533e5c31af7Sopenharmony_ci--
534e5c31af7Sopenharmony_ci
535e5c31af7Sopenharmony_ci[open,refpage='VkViewportCoordinateSwizzleNV',desc='Specify how a viewport coordinate is swizzled',type='enums']
536e5c31af7Sopenharmony_ci--
537e5c31af7Sopenharmony_ciPossible values of the slink:VkViewportSwizzleNV::pname:x, pname:y, pname:z,
538e5c31af7Sopenharmony_ciand pname:w members, specifying swizzling of the corresponding components of
539e5c31af7Sopenharmony_ciprimitives, are:
540e5c31af7Sopenharmony_ci
541e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkViewportCoordinateSwizzleNV.txt[]
542e5c31af7Sopenharmony_ci
543e5c31af7Sopenharmony_ciThese values are described in detail in <<vertexpostproc-viewport-swizzle,
544e5c31af7Sopenharmony_ciViewport Swizzle>>.
545e5c31af7Sopenharmony_ci--
546e5c31af7Sopenharmony_ciendif::VK_NV_viewport_swizzle[]
547e5c31af7Sopenharmony_ci
548e5c31af7Sopenharmony_ci
549e5c31af7Sopenharmony_ci[[vertexpostproc-flatshading]]
550e5c31af7Sopenharmony_ci== Flat Shading
551e5c31af7Sopenharmony_ci
552e5c31af7Sopenharmony_ci_Flat shading_ a vertex output attribute means to assign all vertices of the
553e5c31af7Sopenharmony_ciprimitive the same value for that output.
554e5c31af7Sopenharmony_ciThe output values assigned are those of the _provoking vertex_ of the
555e5c31af7Sopenharmony_ciprimitive.
556e5c31af7Sopenharmony_ciFlat shading is applied to those vertex attributes that
557e5c31af7Sopenharmony_ci<<interfaces-iointerfaces-matching,match>> fragment input attributes which
558e5c31af7Sopenharmony_ciare decorated as code:Flat.
559e5c31af7Sopenharmony_ci
560e5c31af7Sopenharmony_ciIf neither <<geometry,geometry>> nor <<tessellation,tessellation shading>>
561e5c31af7Sopenharmony_ciis active, the provoking vertex is determined by the
562e5c31af7Sopenharmony_ci<<drawing-primitive-topologies, primitive topology>> defined by
563e5c31af7Sopenharmony_cislink:VkPipelineInputAssemblyStateCreateInfo:pname:topology used to execute
564e5c31af7Sopenharmony_cithe <<drawing,drawing command>>.
565e5c31af7Sopenharmony_ci
566e5c31af7Sopenharmony_ciIf <<geometry,geometry shading>> is active, the provoking vertex is
567e5c31af7Sopenharmony_cidetermined by the <<drawing-primitive-topologies, primitive topology>>
568e5c31af7Sopenharmony_cidefined by the <<drawing-point-lists, code:OutputPoints>>,
569e5c31af7Sopenharmony_ci<<drawing-line-strips, code:OutputLineStrips>>, or
570e5c31af7Sopenharmony_ci<<drawing-triangle-strips, code:OutputTriangleStrips>> execution mode.
571e5c31af7Sopenharmony_ci
572e5c31af7Sopenharmony_ciIf <<tessellation,tessellation shading>> is active but <<geometry,geometry
573e5c31af7Sopenharmony_cishading>> is not, the provoking vertex may: be any of the vertices in each
574e5c31af7Sopenharmony_ciprimitive.
575e5c31af7Sopenharmony_ci
576e5c31af7Sopenharmony_ciifdef::VK_EXT_provoking_vertex[]
577e5c31af7Sopenharmony_ci[open,refpage='VkPipelineRasterizationProvokingVertexStateCreateInfoEXT',desc='Structure specifying provoking vertex mode used by a graphics pipeline',type='structs']
578e5c31af7Sopenharmony_ci--
579e5c31af7Sopenharmony_ciFor a given primitive topology, the pipeline's provoking vertex mode
580e5c31af7Sopenharmony_cidetermines which vertex is the provoking vertex.
581e5c31af7Sopenharmony_ciTo specify the provoking vertex mode, include a
582e5c31af7Sopenharmony_cisname:VkPipelineRasterizationProvokingVertexStateCreateInfoEXT structure in
583e5c31af7Sopenharmony_cithe slink:VkPipelineRasterizationStateCreateInfo::pname:pNext chain when
584e5c31af7Sopenharmony_cicreating the pipeline.
585e5c31af7Sopenharmony_ci
586e5c31af7Sopenharmony_ciThe sname:VkPipelineRasterizationProvokingVertexStateCreateInfoEXT structure
587e5c31af7Sopenharmony_ciis defined as:
588e5c31af7Sopenharmony_ci
589e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineRasterizationProvokingVertexStateCreateInfoEXT.txt[]
590e5c31af7Sopenharmony_ci
591e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
592e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
593e5c31af7Sopenharmony_ci    structure.
594e5c31af7Sopenharmony_ci  * pname:provokingVertexMode is a elink:VkProvokingVertexModeEXT value
595e5c31af7Sopenharmony_ci    selecting the provoking vertex mode.
596e5c31af7Sopenharmony_ci
597e5c31af7Sopenharmony_ciIf this struct is not provided when creating the pipeline, the pipeline will
598e5c31af7Sopenharmony_ciuse the ename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT mode.
599e5c31af7Sopenharmony_ci
600e5c31af7Sopenharmony_ciIf the
601e5c31af7Sopenharmony_ci<<limits-provokingVertexModePerPipeline,provokingVertexModePerPipeline>>
602e5c31af7Sopenharmony_cilimit is ename:VK_FALSE, then all pipelines bound within a render pass
603e5c31af7Sopenharmony_ciinstance must: have the same pname:provokingVertexMode.
604e5c31af7Sopenharmony_ci
605e5c31af7Sopenharmony_ci.Valid Usage
606e5c31af7Sopenharmony_ci****
607e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineRasterizationProvokingVertexStateCreateInfoEXT-provokingVertexMode-04883]]
608e5c31af7Sopenharmony_ci    If pname:provokingVertexMode is
609e5c31af7Sopenharmony_ci    ename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, then the
610e5c31af7Sopenharmony_ci    <<features-provokingVertexLast,provokingVertexLast>> feature must: be
611e5c31af7Sopenharmony_ci    enabled
612e5c31af7Sopenharmony_ci****
613e5c31af7Sopenharmony_ci
614e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineRasterizationProvokingVertexStateCreateInfoEXT.txt[]
615e5c31af7Sopenharmony_ci--
616e5c31af7Sopenharmony_ci
617e5c31af7Sopenharmony_ci[open,refpage='VkProvokingVertexModeEXT',desc='Specify which vertex in a primitive is the provoking vertex',type='enums']
618e5c31af7Sopenharmony_ci--
619e5c31af7Sopenharmony_ciPossible values of
620e5c31af7Sopenharmony_cislink:VkPipelineRasterizationProvokingVertexStateCreateInfoEXT::pname:provokingVertexMode
621e5c31af7Sopenharmony_ciare:
622e5c31af7Sopenharmony_ci
623e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkProvokingVertexModeEXT.txt[]
624e5c31af7Sopenharmony_ci
625e5c31af7Sopenharmony_ci  * ename:VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT specifies that the
626e5c31af7Sopenharmony_ci    provoking vertex is the first non-adjacency vertex in the list of
627e5c31af7Sopenharmony_ci    vertices used by a primitive.
628e5c31af7Sopenharmony_ci  * ename:VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT specifies that the
629e5c31af7Sopenharmony_ci    provoking vertex is the last non-adjacency vertex in the list of
630e5c31af7Sopenharmony_ci    vertices used by a primitive.
631e5c31af7Sopenharmony_ci
632e5c31af7Sopenharmony_ciThese modes are described more precisely in
633e5c31af7Sopenharmony_ci<<drawing-primitive-topologies,Primitive Topologies>>.
634e5c31af7Sopenharmony_ci--
635e5c31af7Sopenharmony_ciendif::VK_EXT_provoking_vertex[]
636e5c31af7Sopenharmony_ci
637e5c31af7Sopenharmony_ci
638e5c31af7Sopenharmony_ci[[vertexpostproc-clipping]]
639e5c31af7Sopenharmony_ci== Primitive Clipping
640e5c31af7Sopenharmony_ci
641e5c31af7Sopenharmony_ciPrimitives are culled against the _cull volume_ and then clipped to the
642e5c31af7Sopenharmony_ci_clip volume_.
643e5c31af7Sopenharmony_ciIn clip coordinates, the _view volume_ is defined by:
644e5c31af7Sopenharmony_ci
645e5c31af7Sopenharmony_ci[latexmath]
646e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
647e5c31af7Sopenharmony_ci\begin{array}{c}
648e5c31af7Sopenharmony_ci-w_c \leq x_c \leq w_c \\
649e5c31af7Sopenharmony_ci-w_c \leq y_c \leq w_c \\
650e5c31af7Sopenharmony_ciz_m \leq z_c \leq w_c
651e5c31af7Sopenharmony_ci\end{array}
652e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
653e5c31af7Sopenharmony_ci
654e5c31af7Sopenharmony_ciwhere
655e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_clip_control[]
656e5c31af7Sopenharmony_ciif
657e5c31af7Sopenharmony_cislink:VkPipelineViewportDepthClipControlCreateInfoEXT::pname:negativeOneToOne
658e5c31af7Sopenharmony_ciis ename:VK_TRUE [eq]#z~m~# is equal to [eq]#-w~c~# otherwise
659e5c31af7Sopenharmony_ciendif::VK_EXT_depth_clip_control[]
660e5c31af7Sopenharmony_ci[eq]#z~m~# is equal to zero.
661e5c31af7Sopenharmony_ci
662e5c31af7Sopenharmony_ciThis view volume can: be further restricted by as many as
663e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits::pname:maxClipDistances client-defined
664e5c31af7Sopenharmony_cihalf-spaces.
665e5c31af7Sopenharmony_ci
666e5c31af7Sopenharmony_ciThe cull volume is the intersection of up to
667e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits::pname:maxCullDistances client-defined
668e5c31af7Sopenharmony_cihalf-spaces (if no client-defined cull half-spaces are enabled, culling
669e5c31af7Sopenharmony_ciagainst the cull volume is skipped).
670e5c31af7Sopenharmony_ci
671e5c31af7Sopenharmony_ciA shader must: write a single cull distance for each enabled cull half-space
672e5c31af7Sopenharmony_cito elements of the code:CullDistance array.
673e5c31af7Sopenharmony_ciIf the cull distance for any enabled cull half-space is negative for all of
674e5c31af7Sopenharmony_cithe vertices of the primitive under consideration, the primitive is
675e5c31af7Sopenharmony_cidiscarded.
676e5c31af7Sopenharmony_ciOtherwise the primitive is clipped against the clip volume as defined below.
677e5c31af7Sopenharmony_ci
678e5c31af7Sopenharmony_ciThe clip volume is the intersection of up to
679e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits::pname:maxClipDistances client-defined
680e5c31af7Sopenharmony_cihalf-spaces with the view volume (if no client-defined clip half-spaces are
681e5c31af7Sopenharmony_cienabled, the clip volume is the view volume).
682e5c31af7Sopenharmony_ci
683e5c31af7Sopenharmony_ciA shader must: write a single clip distance for each enabled clip half-space
684e5c31af7Sopenharmony_cito elements of the code:ClipDistance array.
685e5c31af7Sopenharmony_ciClip half-space [eq]#i# is then given by the set of points satisfying the
686e5c31af7Sopenharmony_ciinequality
687e5c31af7Sopenharmony_ci
688e5c31af7Sopenharmony_ci  {empty}:: [eq]#c~i~(**P**) {geq} 0#
689e5c31af7Sopenharmony_ci
690e5c31af7Sopenharmony_ciwhere [eq]#c~i~(**P**)# is the clip distance [eq]#i# at point [eq]#**P**#.
691e5c31af7Sopenharmony_ciFor point primitives, [eq]#c~i~(**P**)# is simply the clip distance for the
692e5c31af7Sopenharmony_civertex in question.
693e5c31af7Sopenharmony_ciFor line and triangle primitives, per-vertex clip distances are interpolated
694e5c31af7Sopenharmony_ciusing a weighted mean, with weights derived according to the algorithms
695e5c31af7Sopenharmony_cidescribed in sections <<primsrast-lines-basic,Basic Line Segment
696e5c31af7Sopenharmony_ciRasterization>> and <<primsrast-polygons-basic,Basic Polygon
697e5c31af7Sopenharmony_ciRasterization>>, using the perspective interpolation equations.
698e5c31af7Sopenharmony_ci
699e5c31af7Sopenharmony_ciThe number of client-defined clip and cull half-spaces that are enabled is
700e5c31af7Sopenharmony_cidetermined by the explicit size of the built-in arrays code:ClipDistance and
701e5c31af7Sopenharmony_cicode:CullDistance, respectively, declared as an output in the interface of
702e5c31af7Sopenharmony_cithe entry point of the final shader stage before clipping.
703e5c31af7Sopenharmony_ci
704e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_clip_enable[]
705e5c31af7Sopenharmony_ciIf slink:VkPipelineRasterizationDepthClipStateCreateInfoEXT is present in
706e5c31af7Sopenharmony_cithe graphics pipeline state then depth clipping is disabled if
707e5c31af7Sopenharmony_cislink:VkPipelineRasterizationDepthClipStateCreateInfoEXT::pname:depthClipEnable
708e5c31af7Sopenharmony_ciis ename:VK_FALSE.
709e5c31af7Sopenharmony_ciOtherwise, if slink:VkPipelineRasterizationDepthClipStateCreateInfoEXT is
710e5c31af7Sopenharmony_cinot present, depth clipping is disabled when
711e5c31af7Sopenharmony_cislink:VkPipelineRasterizationStateCreateInfo::pname:depthClampEnable is
712e5c31af7Sopenharmony_ciename:VK_TRUE.
713e5c31af7Sopenharmony_ciendif::VK_EXT_depth_clip_enable[]
714e5c31af7Sopenharmony_ciifndef::VK_EXT_depth_clip_enable[]
715e5c31af7Sopenharmony_ciDepth clamping is enabled or disabled via the pname:depthClampEnable enable
716e5c31af7Sopenharmony_ciof the slink:VkPipelineRasterizationStateCreateInfo structure.
717e5c31af7Sopenharmony_ciDepth clipping is disabled when pname:depthClampEnable is ename:VK_TRUE.
718e5c31af7Sopenharmony_ciendif::VK_EXT_depth_clip_enable[]
719e5c31af7Sopenharmony_ciWhen depth clipping is disabled, the plane equation
720e5c31af7Sopenharmony_ci
721e5c31af7Sopenharmony_ci  {empty}:: [eq]#z~m~ {leq} z~c~ {leq} w~c~#
722e5c31af7Sopenharmony_ci
723e5c31af7Sopenharmony_ci(see the clip volume definition above) is ignored by view volume clipping
724e5c31af7Sopenharmony_ci(effectively, there is no near or far plane clipping).
725e5c31af7Sopenharmony_ci
726e5c31af7Sopenharmony_ciIf the primitive under consideration is a point or line segment, then
727e5c31af7Sopenharmony_ciclipping passes it unchanged if its vertices lie entirely within the clip
728e5c31af7Sopenharmony_civolume.
729e5c31af7Sopenharmony_ci
730e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_maintenance2[]
731e5c31af7Sopenharmony_ciIf a point's vertex lies outside of the clip volume, the entire primitive
732e5c31af7Sopenharmony_cimay: be discarded.
733e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance2[]
734e5c31af7Sopenharmony_ci
735e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance2[]
736e5c31af7Sopenharmony_ci[open,refpage='VkPointClippingBehavior',desc='Enum specifying the point clipping behavior',type='enums']
737e5c31af7Sopenharmony_ci--
738e5c31af7Sopenharmony_ciPossible values of
739e5c31af7Sopenharmony_cislink:VkPhysicalDevicePointClippingProperties::pname:pointClippingBehavior,
740e5c31af7Sopenharmony_cispecifying clipping behavior of a point primitive whose vertex lies outside
741e5c31af7Sopenharmony_cithe clip volume, are:
742e5c31af7Sopenharmony_ci
743e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkPointClippingBehavior.txt[]
744e5c31af7Sopenharmony_ci
745e5c31af7Sopenharmony_ciifdef::VK_KHR_maintenance2[]
746e5c31af7Sopenharmony_cior the equivalent
747e5c31af7Sopenharmony_ci
748e5c31af7Sopenharmony_ciinclude::{generated}/api/enums/VkPointClippingBehaviorKHR.txt[]
749e5c31af7Sopenharmony_ciendif::VK_KHR_maintenance2[]
750e5c31af7Sopenharmony_ci
751e5c31af7Sopenharmony_ci  * ename:VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES specifies that the
752e5c31af7Sopenharmony_ci    primitive is discarded if the vertex lies outside any clip plane,
753e5c31af7Sopenharmony_ci    including the planes bounding the view volume.
754e5c31af7Sopenharmony_ci  * ename:VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY specifies that
755e5c31af7Sopenharmony_ci    the primitive is discarded only if the vertex lies outside any user clip
756e5c31af7Sopenharmony_ci    plane.
757e5c31af7Sopenharmony_ci--
758e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance2[]
759e5c31af7Sopenharmony_ci
760e5c31af7Sopenharmony_ciIf either of a line segment's vertices lie outside of the clip volume, the
761e5c31af7Sopenharmony_ciline segment may: be clipped, with new vertex coordinates computed for each
762e5c31af7Sopenharmony_civertex that lies outside the clip volume.
763e5c31af7Sopenharmony_ciA clipped line segment endpoint lies on both the original line segment and
764e5c31af7Sopenharmony_cithe boundary of the clip volume.
765e5c31af7Sopenharmony_ci
766e5c31af7Sopenharmony_ciThis clipping produces a value, [eq]#0 {leq} t {leq} 1#, for each clipped
767e5c31af7Sopenharmony_civertex.
768e5c31af7Sopenharmony_ciIf the coordinates of a clipped vertex are [eq]#**P**# and the unclipped
769e5c31af7Sopenharmony_ciline segment's vertex coordinates are [eq]#**P**~1~# and [eq]#**P**~2~#,
770e5c31af7Sopenharmony_cithen [eq]#t# satisfies the following equation
771e5c31af7Sopenharmony_ci
772e5c31af7Sopenharmony_ci  {empty}:: [eq]#**P** = t **P**~1~ {plus} (1-t) **P**~2~#.
773e5c31af7Sopenharmony_ci
774e5c31af7Sopenharmony_ci[eq]#t# is used to clip vertex output attributes as described in
775e5c31af7Sopenharmony_ci<<vertexpostproc-clipping-shader-outputs,Clipping Shader Outputs>>.
776e5c31af7Sopenharmony_ci
777e5c31af7Sopenharmony_ciIf the primitive is a polygon, it passes unchanged if every one of its edges
778e5c31af7Sopenharmony_cilies entirely inside the clip volume, and is either clipped or discarded
779e5c31af7Sopenharmony_ciotherwise.
780e5c31af7Sopenharmony_ciIf the edges of the polygon intersect the boundary of the clip volume, the
781e5c31af7Sopenharmony_ciintersecting edges are reconnected by new edges that lie along the boundary
782e5c31af7Sopenharmony_ciof the clip volume - in some cases requiring the introduction of new
783e5c31af7Sopenharmony_civertices into a polygon.
784e5c31af7Sopenharmony_ci
785e5c31af7Sopenharmony_ciIf a polygon intersects an edge of the clip volume's boundary, the clipped
786e5c31af7Sopenharmony_cipolygon must: include a point on this boundary edge.
787e5c31af7Sopenharmony_ci
788e5c31af7Sopenharmony_ciPrimitives rendered with user-defined half-spaces must: satisfy a
789e5c31af7Sopenharmony_cicomplementarity criterion.
790e5c31af7Sopenharmony_ciSuppose a series of primitives is drawn where each vertex [eq]#i# has a
791e5c31af7Sopenharmony_cisingle specified clip distance [eq]#d~i~# (or a number of similarly
792e5c31af7Sopenharmony_cispecified clip distances, if multiple half-spaces are enabled).
793e5c31af7Sopenharmony_ciNext, suppose that the same series of primitives are drawn again with each
794e5c31af7Sopenharmony_cisuch clip distance replaced by [eq]#-d~i~# (and the graphics pipeline is
795e5c31af7Sopenharmony_ciotherwise the same).
796e5c31af7Sopenharmony_ciIn this case, primitives must: not be missing any pixels, and pixels must:
797e5c31af7Sopenharmony_cinot be drawn twice in regions where those primitives are cut by the clip
798e5c31af7Sopenharmony_ciplanes.
799e5c31af7Sopenharmony_ci
800e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_clip_control[]
801e5c31af7Sopenharmony_ci
802e5c31af7Sopenharmony_ci[open,refpage='VkPipelineViewportDepthClipControlCreateInfoEXT',desc='Structure specifying parameters of a newly created pipeline depth clip control state',type='structs']
803e5c31af7Sopenharmony_ci--
804e5c31af7Sopenharmony_ci
805e5c31af7Sopenharmony_ciThe sname:VkPipelineViewportDepthClipControlCreateInfoEXT structure is
806e5c31af7Sopenharmony_cidefined as:
807e5c31af7Sopenharmony_ci
808e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineViewportDepthClipControlCreateInfoEXT.txt[]
809e5c31af7Sopenharmony_ci
810e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
811e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
812e5c31af7Sopenharmony_ci    structure.
813e5c31af7Sopenharmony_ci  * pname:negativeOneToOne sets the [eq]#z~m~# in the _view volume_ to
814e5c31af7Sopenharmony_ci    [eq]#-w~c~#
815e5c31af7Sopenharmony_ci
816e5c31af7Sopenharmony_ci.Valid Usage
817e5c31af7Sopenharmony_ci****
818e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportDepthClipControlCreateInfoEXT-negativeOneToOne-06470]]
819e5c31af7Sopenharmony_ci    If <<features-depthClipControl,depthClipControl>> is not enabled,
820e5c31af7Sopenharmony_ci    pname:negativeOneToOne must: be ename:VK_FALSE
821e5c31af7Sopenharmony_ci****
822e5c31af7Sopenharmony_ci
823e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineViewportDepthClipControlCreateInfoEXT.txt[]
824e5c31af7Sopenharmony_ci--
825e5c31af7Sopenharmony_ci
826e5c31af7Sopenharmony_ciendif::VK_EXT_depth_clip_control[]
827e5c31af7Sopenharmony_ci
828e5c31af7Sopenharmony_ci[[vertexpostproc-clipping-shader-outputs]]
829e5c31af7Sopenharmony_ci== Clipping Shader Outputs
830e5c31af7Sopenharmony_ci
831e5c31af7Sopenharmony_ciNext, vertex output attributes are clipped.
832e5c31af7Sopenharmony_ciThe output values associated with a vertex that lies within the clip volume
833e5c31af7Sopenharmony_ciare unaffected by clipping.
834e5c31af7Sopenharmony_ciIf a primitive is clipped, however, the output values assigned to vertices
835e5c31af7Sopenharmony_ciproduced by clipping are clipped.
836e5c31af7Sopenharmony_ci
837e5c31af7Sopenharmony_ciLet the output values assigned to the two vertices [eq]#**P**~1~# and
838e5c31af7Sopenharmony_ci[eq]#**P**~2~# of an unclipped edge be [eq]#**c**~1~# and [eq]#**c**~2~#.
839e5c31af7Sopenharmony_ciThe value of [eq]#t# (see <<vertexpostproc-clipping,Primitive Clipping>>)
840e5c31af7Sopenharmony_cifor a clipped point [eq]#**P**# is used to obtain the output value
841e5c31af7Sopenharmony_ciassociated with [eq]#**P**# as
842e5c31af7Sopenharmony_ci
843e5c31af7Sopenharmony_ci  {empty}:: [eq]#**c** = t **c**~1~ {plus} (1-t) **c**~2~#.
844e5c31af7Sopenharmony_ci
845e5c31af7Sopenharmony_ci(Multiplying an output value by a scalar means multiplying each of _x_, _y_,
846e5c31af7Sopenharmony_ci_z_, and _w_ by the scalar.)
847e5c31af7Sopenharmony_ci
848e5c31af7Sopenharmony_ciSince this computation is performed in clip space before division by
849e5c31af7Sopenharmony_ci[eq]#w~c~#, clipped output values are perspective-correct.
850e5c31af7Sopenharmony_ci
851e5c31af7Sopenharmony_ciPolygon clipping creates a clipped vertex along an edge of the clip volume's
852e5c31af7Sopenharmony_ciboundary.
853e5c31af7Sopenharmony_ciThis situation is handled by noting that polygon clipping proceeds by
854e5c31af7Sopenharmony_ciclipping against one half-space at a time.
855e5c31af7Sopenharmony_ciOutput value clipping is done in the same way, so that clipped points always
856e5c31af7Sopenharmony_cioccur at the intersection of polygon edges (possibly already clipped) with
857e5c31af7Sopenharmony_cithe clip volume's boundary.
858e5c31af7Sopenharmony_ci
859e5c31af7Sopenharmony_ciFor vertex output attributes whose matching fragment input attributes are
860e5c31af7Sopenharmony_cidecorated with code:NoPerspective, the value of [eq]#t# used to obtain the
861e5c31af7Sopenharmony_cioutput value associated with [eq]#**P**# will be adjusted to produce results
862e5c31af7Sopenharmony_cithat vary linearly in framebuffer space.
863e5c31af7Sopenharmony_ci
864e5c31af7Sopenharmony_ciOutput attributes of integer or unsigned integer type must: always be flat
865e5c31af7Sopenharmony_cishaded.
866e5c31af7Sopenharmony_ciFlat shaded attributes are constant over the primitive being rasterized (see
867e5c31af7Sopenharmony_ci<<primsrast-lines-basic,Basic Line Segment Rasterization>> and
868e5c31af7Sopenharmony_ci<<primsrast-polygons-basic,Basic Polygon Rasterization>>), and no
869e5c31af7Sopenharmony_ciinterpolation is performed.
870e5c31af7Sopenharmony_ciThe output value [eq]#**c**# is taken from either [eq]#**c**~1~# or
871e5c31af7Sopenharmony_ci[eq]#**c**~2~#, since flat shading has already occurred and the two values
872e5c31af7Sopenharmony_ciare identical.
873e5c31af7Sopenharmony_ci
874e5c31af7Sopenharmony_ciifdef::VK_NV_clip_space_w_scaling[]
875e5c31af7Sopenharmony_ciinclude::{chapters}/VK_NV_clip_space_w_scaling/vertexpostproc.txt[]
876e5c31af7Sopenharmony_ciendif::VK_NV_clip_space_w_scaling[]
877e5c31af7Sopenharmony_ci
878e5c31af7Sopenharmony_ci
879e5c31af7Sopenharmony_ci[[vertexpostproc-coord-transform]]
880e5c31af7Sopenharmony_ci== Coordinate Transformations
881e5c31af7Sopenharmony_ci
882e5c31af7Sopenharmony_ci_Clip coordinates_ for a vertex result from shader execution, which yields a
883e5c31af7Sopenharmony_civertex coordinate code:Position.
884e5c31af7Sopenharmony_ci
885e5c31af7Sopenharmony_ciPerspective division on clip coordinates yields _normalized device
886e5c31af7Sopenharmony_cicoordinates_, followed by a _viewport_ transformation (see
887e5c31af7Sopenharmony_ci<<vertexpostproc-viewport,Controlling the Viewport>>) to convert these
888e5c31af7Sopenharmony_cicoordinates into _framebuffer coordinates_.
889e5c31af7Sopenharmony_ci
890e5c31af7Sopenharmony_ciIf a vertex in clip coordinates has a position given by
891e5c31af7Sopenharmony_ci
892e5c31af7Sopenharmony_ci[latexmath]
893e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
894e5c31af7Sopenharmony_ci\left(\begin{array}{c}
895e5c31af7Sopenharmony_cix_c \\
896e5c31af7Sopenharmony_ciy_c \\
897e5c31af7Sopenharmony_ciz_c \\
898e5c31af7Sopenharmony_ciw_c
899e5c31af7Sopenharmony_ci\end{array}\right)
900e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
901e5c31af7Sopenharmony_ci
902e5c31af7Sopenharmony_cithen the vertex's normalized device coordinates are
903e5c31af7Sopenharmony_ci[latexmath]
904e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
905e5c31af7Sopenharmony_ci\left(
906e5c31af7Sopenharmony_ci        \begin{array}{c}
907e5c31af7Sopenharmony_ci                x_d \\
908e5c31af7Sopenharmony_ci                y_d \\
909e5c31af7Sopenharmony_ci                z_d
910e5c31af7Sopenharmony_ci        \end{array}
911e5c31af7Sopenharmony_ci\right) =
912e5c31af7Sopenharmony_ci\left(
913e5c31af7Sopenharmony_ci        \begin{array}{c}
914e5c31af7Sopenharmony_ci                \frac{x_c}{w_c} \\
915e5c31af7Sopenharmony_ci                \frac{y_c}{w_c} \\
916e5c31af7Sopenharmony_ci                \frac{z_c}{w_c}
917e5c31af7Sopenharmony_ci        \end{array}
918e5c31af7Sopenharmony_ci\right)
919e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
920e5c31af7Sopenharmony_ci
921e5c31af7Sopenharmony_ci
922e5c31af7Sopenharmony_ciifdef::VK_QCOM_render_pass_transform[]
923e5c31af7Sopenharmony_ci[[vertexpostproc-renderpass-transform]]
924e5c31af7Sopenharmony_ci== Render Pass Transform
925e5c31af7Sopenharmony_ci
926e5c31af7Sopenharmony_ciA _render pass transform_ can: be enabled for render pass instances.
927e5c31af7Sopenharmony_ciThe clip coordinates [eq]#(x~c~, y~c~)# that result from vertex shader
928e5c31af7Sopenharmony_ciexecution are transformed by a rotation of 0, 90, 180, or 270 degrees in the
929e5c31af7Sopenharmony_ciXY plane, centered at the origin.
930e5c31af7Sopenharmony_ci
931e5c31af7Sopenharmony_ciWhen _Render pass transform_ is enabled, the transform applies to all
932e5c31af7Sopenharmony_ciprimitives for all subpasses of the render pass.
933e5c31af7Sopenharmony_ciThe transformed vertex in clip coordinates has a position given by
934e5c31af7Sopenharmony_ci
935e5c31af7Sopenharmony_ci[latexmath]
936e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
937e5c31af7Sopenharmony_ci\left(
938e5c31af7Sopenharmony_ci        \begin{array}{c}
939e5c31af7Sopenharmony_ci                x_{c_{trans}} \\
940e5c31af7Sopenharmony_ci                y_{c_{trans}} \\
941e5c31af7Sopenharmony_ci                z_{c_{trans}}
942e5c31af7Sopenharmony_ci        \end{array}
943e5c31af7Sopenharmony_ci\right) =
944e5c31af7Sopenharmony_ci\left(
945e5c31af7Sopenharmony_ci        \begin{array}{c}
946e5c31af7Sopenharmony_ci                x_{c} \cos \theta - y_{c} \sin \theta \\
947e5c31af7Sopenharmony_ci                x_{c} \sin \theta + y_{c} \cos \theta \\
948e5c31af7Sopenharmony_ci                z_c
949e5c31af7Sopenharmony_ci        \end{array}
950e5c31af7Sopenharmony_ci\right)
951e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
952e5c31af7Sopenharmony_ci
953e5c31af7Sopenharmony_ciwhere
954e5c31af7Sopenharmony_ci
955e5c31af7Sopenharmony_ci  * _[eq]#{theta}#_ is 0 degrees for
956e5c31af7Sopenharmony_ci    ename:VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR
957e5c31af7Sopenharmony_ci  * _[eq]#{theta}#_ is 90 degrees for
958e5c31af7Sopenharmony_ci    ename:VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR
959e5c31af7Sopenharmony_ci  * _[eq]#{theta}#_ is 180 degrees for
960e5c31af7Sopenharmony_ci    ename:VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR
961e5c31af7Sopenharmony_ci  * _[eq]#{theta}#_ is 270 degrees for
962e5c31af7Sopenharmony_ci    ename:VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR
963e5c31af7Sopenharmony_ci
964e5c31af7Sopenharmony_ci
965e5c31af7Sopenharmony_ciThe transformed vertex's normalized device coordinates are
966e5c31af7Sopenharmony_ci[latexmath]
967e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
968e5c31af7Sopenharmony_ci\left(
969e5c31af7Sopenharmony_ci        \begin{array}{c}
970e5c31af7Sopenharmony_ci                x_d \\
971e5c31af7Sopenharmony_ci                y_d \\
972e5c31af7Sopenharmony_ci                z_d
973e5c31af7Sopenharmony_ci        \end{array}
974e5c31af7Sopenharmony_ci\right) =
975e5c31af7Sopenharmony_ci\left(
976e5c31af7Sopenharmony_ci        \begin{array}{c}
977e5c31af7Sopenharmony_ci                \frac{x_{c_{trans}}}{w_c} \\
978e5c31af7Sopenharmony_ci                \frac{y_{c_{trans}}}{w_c} \\
979e5c31af7Sopenharmony_ci                \frac{z_{c_{trans}}}{w_c}
980e5c31af7Sopenharmony_ci        \end{array}
981e5c31af7Sopenharmony_ci\right)
982e5c31af7Sopenharmony_ci++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
983e5c31af7Sopenharmony_ci
984e5c31af7Sopenharmony_ci
985e5c31af7Sopenharmony_ciWhen render pass transform is enabled for a render pass instance, the
986e5c31af7Sopenharmony_cifollowing additional features are enabled:
987e5c31af7Sopenharmony_ci
988e5c31af7Sopenharmony_ci  * Each slink:VkViewport specified by either
989e5c31af7Sopenharmony_ci    slink:VkPipelineViewportStateCreateInfo::pname:pViewports or
990e5c31af7Sopenharmony_ci    flink:vkCmdSetViewport will have its width/height [eq]#(p~x~, p~y~)# and
991e5c31af7Sopenharmony_ci    its center [eq]#(o~x~, o~y~)# similarly transformed by the
992e5c31af7Sopenharmony_ci    implementation.
993e5c31af7Sopenharmony_ci  * Each scissor specified by
994e5c31af7Sopenharmony_ci    slink:VkPipelineViewportStateCreateInfo::pname:pScissors or
995e5c31af7Sopenharmony_ci    flink:vkCmdSetScissor will have its [eq]#(offset~x~, offset~y~)# and
996e5c31af7Sopenharmony_ci    [eq]#(extent~x~, extent~y~)# similarly transformed by the
997e5c31af7Sopenharmony_ci    implementation.
998e5c31af7Sopenharmony_ci  * The pname:renderArea specified in
999e5c31af7Sopenharmony_ci    slink:VkCommandBufferInheritanceRenderPassTransformInfoQCOM and
1000e5c31af7Sopenharmony_ci    slink:VkRenderPassBeginInfo will be similarly transformed by the
1001e5c31af7Sopenharmony_ci    implementation.
1002e5c31af7Sopenharmony_ci  * The [eq]#(x, y)# components of shader variables with built-in
1003e5c31af7Sopenharmony_ci    decorations code:FragCoord, code:SamplePosition, or code:PointCoord will
1004e5c31af7Sopenharmony_ci    be similarly transformed by the implementation.
1005e5c31af7Sopenharmony_ci  * The [eq]#(x,y)# components of the code:offset operand of the
1006e5c31af7Sopenharmony_ci    code:InterpolateAtOffset extended instruction will be similarly
1007e5c31af7Sopenharmony_ci    transformed by the implementation.
1008e5c31af7Sopenharmony_ci  * The values returned by SPIR-V <<shaders-derivative-operations,
1009e5c31af7Sopenharmony_ci    derivative instructions>> code:OpDPdx, code:OpDPdy, code:OpDPdxCourse,
1010e5c31af7Sopenharmony_ci    code:OpDPdyCourse, code:OpDPdxFine, code:OpDPdyFine will be similarly
1011e5c31af7Sopenharmony_ci    transformed by the implementation.
1012e5c31af7Sopenharmony_ci
1013e5c31af7Sopenharmony_ci
1014e5c31af7Sopenharmony_ciThe net result of the above, is that applications can: act as if rendering
1015e5c31af7Sopenharmony_cito a framebuffer oriented with the
1016e5c31af7Sopenharmony_cislink:VkSurfaceCapabilitiesKHR::pname:currentTransform.
1017e5c31af7Sopenharmony_ciIn other words, applications can: act as if the presentation engine will be
1018e5c31af7Sopenharmony_ciperforming the transformation of the swapchain image after rendering and
1019e5c31af7Sopenharmony_ciprior to presentation to the user.
1020e5c31af7Sopenharmony_ciIn fact, the transformation of the various items cited above are being
1021e5c31af7Sopenharmony_cihandled by the implementation as the rendering takes place.
1022e5c31af7Sopenharmony_ci
1023e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_transform[]
1024e5c31af7Sopenharmony_ci
1025e5c31af7Sopenharmony_ci
1026e5c31af7Sopenharmony_ci[[vertexpostproc-viewport]]
1027e5c31af7Sopenharmony_ci== Controlling the Viewport
1028e5c31af7Sopenharmony_ci
1029e5c31af7Sopenharmony_ciThe viewport transformation is determined by the selected viewport's width
1030e5c31af7Sopenharmony_ciand height in pixels, [eq]#p~x~# and [eq]#p~y~#, respectively, and its
1031e5c31af7Sopenharmony_cicenter [eq]#(o~x~, o~y~)# (also in pixels), as well as its depth range min
1032e5c31af7Sopenharmony_ciand max determining a depth range scale value [eq]#p~z~# and a depth range
1033e5c31af7Sopenharmony_cibias value [eq]#o~z~# (defined below).
1034e5c31af7Sopenharmony_ciThe vertex's framebuffer coordinates [eq]#(x~f~, y~f~, z~f~)# are given by
1035e5c31af7Sopenharmony_ci
1036e5c31af7Sopenharmony_ci  {empty}:: [eq]#x~f~ = (p~x~ / 2) x~d~ {plus} o~x~#
1037e5c31af7Sopenharmony_ci  {empty}:: [eq]#y~f~ = (p~y~ / 2) y~d~ {plus} o~y~#
1038e5c31af7Sopenharmony_ci  {empty}:: [eq]#z~f~ = p~z~ {times} z~d~ {plus} o~z~#
1039e5c31af7Sopenharmony_ci
1040e5c31af7Sopenharmony_ciMultiple viewports are available, numbered zero up to
1041e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits::pname:maxViewports minus one.
1042e5c31af7Sopenharmony_ciThe number of viewports used by a pipeline is controlled by the
1043e5c31af7Sopenharmony_cipname:viewportCount member of the sname:VkPipelineViewportStateCreateInfo
1044e5c31af7Sopenharmony_cistructure used in pipeline creation.
1045e5c31af7Sopenharmony_ci
1046e5c31af7Sopenharmony_ci[eq]#x~f~# and [eq]#y~f~# have limited precision, where the number of
1047e5c31af7Sopenharmony_cifractional bits retained is specified by
1048e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLimits::pname:subPixelPrecisionBits.
1049e5c31af7Sopenharmony_ciifdef::VK_EXT_line_rasterization[]
1050e5c31af7Sopenharmony_ciWhen rasterizing <<primsrast-lines,line segments>>, the number of fractional
1051e5c31af7Sopenharmony_cibits is specified by
1052e5c31af7Sopenharmony_cisname:VkPhysicalDeviceLineRasterizationPropertiesEXT::pname:lineSubPixelPrecisionBits.
1053e5c31af7Sopenharmony_ciendif::VK_EXT_line_rasterization[]
1054e5c31af7Sopenharmony_ci
1055e5c31af7Sopenharmony_ci[open,refpage='VkPipelineViewportStateCreateInfo',desc='Structure specifying parameters of a newly created pipeline viewport state',type='structs']
1056e5c31af7Sopenharmony_ci--
1057e5c31af7Sopenharmony_ciThe sname:VkPipelineViewportStateCreateInfo structure is defined as:
1058e5c31af7Sopenharmony_ci
1059e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkPipelineViewportStateCreateInfo.txt[]
1060e5c31af7Sopenharmony_ci
1061e5c31af7Sopenharmony_ci  * pname:sType is the type of this structure.
1062e5c31af7Sopenharmony_ci  * pname:pNext is `NULL` or a pointer to a structure extending this
1063e5c31af7Sopenharmony_ci    structure.
1064e5c31af7Sopenharmony_ci  * pname:flags is reserved for future use.
1065e5c31af7Sopenharmony_ci  * pname:viewportCount is the number of viewports used by the pipeline.
1066e5c31af7Sopenharmony_ci  * pname:pViewports is a pointer to an array of slink:VkViewport
1067e5c31af7Sopenharmony_ci    structures, defining the viewport transforms.
1068e5c31af7Sopenharmony_ci    If the viewport state is dynamic, this member is ignored.
1069e5c31af7Sopenharmony_ci  * pname:scissorCount is the number of <<fragops-scissor,scissors>> and
1070e5c31af7Sopenharmony_ci    must: match the number of viewports.
1071e5c31af7Sopenharmony_ci  * pname:pScissors is a pointer to an array of slink:VkRect2D structures
1072e5c31af7Sopenharmony_ci    defining the rectangular bounds of the scissor for the corresponding
1073e5c31af7Sopenharmony_ci    viewport.
1074e5c31af7Sopenharmony_ci    If the scissor state is dynamic, this member is ignored.
1075e5c31af7Sopenharmony_ci
1076e5c31af7Sopenharmony_ci.Valid Usage
1077e5c31af7Sopenharmony_ci****
1078e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-viewportCount-01216]]
1079e5c31af7Sopenharmony_ci    If the <<features-multiViewport,multiple viewports>> feature is not
1080e5c31af7Sopenharmony_ci    enabled, pname:viewportCount must: not be greater than `1`
1081e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-scissorCount-01217]]
1082e5c31af7Sopenharmony_ci    If the <<features-multiViewport,multiple viewports>> feature is not
1083e5c31af7Sopenharmony_ci    enabled, pname:scissorCount must: not be greater than `1`
1084e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-viewportCount-01218]]
1085e5c31af7Sopenharmony_ci    pname:viewportCount must: be less than or equal to
1086e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxViewports
1087e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-scissorCount-01219]]
1088e5c31af7Sopenharmony_ci    pname:scissorCount must: be less than or equal to
1089e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxViewports
1090e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state[]
1091e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-scissorCount-01220]]
1092e5c31af7Sopenharmony_ci    pname:scissorCount and pname:viewportCount must: be identical
1093e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[]
1094e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-x-02821]]
1095e5c31af7Sopenharmony_ci    The pname:x and pname:y members of pname:offset member of any element of
1096e5c31af7Sopenharmony_ci    pname:pScissors must: be greater than or equal to `0`
1097e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-offset-02822]]
1098e5c31af7Sopenharmony_ci    Evaluation of [eq]#(pname:offset.x {plus} pname:extent.width)# must: not
1099e5c31af7Sopenharmony_ci    cause a signed integer addition overflow for any element of
1100e5c31af7Sopenharmony_ci    pname:pScissors
1101e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-offset-02823]]
1102e5c31af7Sopenharmony_ci    Evaluation of [eq]#(pname:offset.y {plus} pname:extent.height)# must:
1103e5c31af7Sopenharmony_ci    not cause a signed integer addition overflow for any element of
1104e5c31af7Sopenharmony_ci    pname:pScissors
1105e5c31af7Sopenharmony_ciifndef::VK_EXT_extended_dynamic_state[]
1106e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-viewportCount-arraylength]]
1107e5c31af7Sopenharmony_ci    pname:viewportCount must: be greater than `0`
1108e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-scissorCount-arraylength]]
1109e5c31af7Sopenharmony_ci    pname:scissorCount must: be greater than `0`
1110e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[]
1111e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[]
1112e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-scissorCount-04134]]
1113e5c31af7Sopenharmony_ci    If the graphics pipeline is being created without
1114e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT and
1115e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT set then
1116e5c31af7Sopenharmony_ci    pname:scissorCount and pname:viewportCount must: be identical
1117e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-viewportCount-04135]]
1118e5c31af7Sopenharmony_ci    If the graphics pipeline is being created with
1119e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT set then
1120e5c31af7Sopenharmony_ci    pname:viewportCount must: be `0`, otherwise it must: be greater than `0`
1121e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-scissorCount-04136]]
1122e5c31af7Sopenharmony_ci    If the graphics pipeline is being created with
1123e5c31af7Sopenharmony_ci    ename:VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT set then
1124e5c31af7Sopenharmony_ci    pname:scissorCount must: be `0`, otherwise it must: be greater than `0`
1125e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[]
1126e5c31af7Sopenharmony_ciifdef::VK_NV_clip_space_w_scaling[]
1127e5c31af7Sopenharmony_ci  * [[VUID-VkPipelineViewportStateCreateInfo-viewportWScalingEnable-01726]]
1128e5c31af7Sopenharmony_ci    If the pname:viewportWScalingEnable member of a
1129e5c31af7Sopenharmony_ci    slink:VkPipelineViewportWScalingStateCreateInfoNV structure included in
1130e5c31af7Sopenharmony_ci    the pname:pNext chain is ename:VK_TRUE, the pname:viewportCount member
1131e5c31af7Sopenharmony_ci    of the slink:VkPipelineViewportWScalingStateCreateInfoNV structure must:
1132e5c31af7Sopenharmony_ci    be greater than or equal to
1133e5c31af7Sopenharmony_ci    slink:VkPipelineViewportStateCreateInfo::pname:viewportCount
1134e5c31af7Sopenharmony_ciendif::VK_NV_clip_space_w_scaling[]
1135e5c31af7Sopenharmony_ci****
1136e5c31af7Sopenharmony_ci
1137e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkPipelineViewportStateCreateInfo.txt[]
1138e5c31af7Sopenharmony_ci--
1139e5c31af7Sopenharmony_ci
1140e5c31af7Sopenharmony_ciifdef::VK_EXT_extended_dynamic_state[]
1141e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetViewportWithCountEXT',desc='Set the viewport count and viewports dynamically for a command buffer',type='protos']
1142e5c31af7Sopenharmony_ci--
1143e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the viewport count and
1144e5c31af7Sopenharmony_civiewports, call:
1145e5c31af7Sopenharmony_ci
1146e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetViewportWithCountEXT.txt[]
1147e5c31af7Sopenharmony_ci
1148e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
1149e5c31af7Sopenharmony_ci    recorded.
1150e5c31af7Sopenharmony_ci  * pname:viewportCount specifies the viewport count.
1151e5c31af7Sopenharmony_ci  * pname:pViewports specifies the viewports to use for drawing.
1152e5c31af7Sopenharmony_ci
1153e5c31af7Sopenharmony_ciThis command sets the viewport count and viewports state for subsequent
1154e5c31af7Sopenharmony_cidrawing commands when the graphics pipeline is created with
1155e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT set in
1156e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
1157e5c31af7Sopenharmony_ciOtherwise, this state is specified by the corresponding
1158e5c31af7Sopenharmony_cislink:VkPipelineViewportStateCreateInfo::pname:viewportCount and
1159e5c31af7Sopenharmony_cipname:pViewports values used to create the currently active pipeline.
1160e5c31af7Sopenharmony_ci
1161e5c31af7Sopenharmony_ci.Valid Usage
1162e5c31af7Sopenharmony_ci****
1163e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetViewportWithCountEXT-None-03393]]
1164e5c31af7Sopenharmony_ci    The <<features-extendedDynamicState, extendedDynamicState>> feature
1165e5c31af7Sopenharmony_ci    must: be enabled
1166e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetViewportWithCountEXT-viewportCount-03394]]
1167e5c31af7Sopenharmony_ci    pname:viewportCount must: be between `1` and
1168e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxViewports, inclusive
1169e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetViewportWithCountEXT-viewportCount-03395]]
1170e5c31af7Sopenharmony_ci    If the <<features-multiViewport,multiple viewports>> feature is not
1171e5c31af7Sopenharmony_ci    enabled, pname:viewportCount must: be `1`
1172e5c31af7Sopenharmony_ciifdef::VK_NV_inherited_viewport_scissor[]
1173e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetViewportWithCountEXT-commandBuffer-04819]]
1174e5c31af7Sopenharmony_ci    pname:commandBuffer must: not have
1175e5c31af7Sopenharmony_ci    slink:VkCommandBufferInheritanceViewportScissorInfoNV::pname:viewportScissor2D
1176e5c31af7Sopenharmony_ci    enabled
1177e5c31af7Sopenharmony_ciendif::VK_NV_inherited_viewport_scissor[]
1178e5c31af7Sopenharmony_ci****
1179e5c31af7Sopenharmony_ci
1180e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetViewportWithCountEXT.txt[]
1181e5c31af7Sopenharmony_ci--
1182e5c31af7Sopenharmony_ci
1183e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetScissorWithCountEXT',desc='Set the scissor count and scissor rectangular bounds dynamically for a command buffer',type='protos']
1184e5c31af7Sopenharmony_ci--
1185e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the scissor count and
1186e5c31af7Sopenharmony_ciscissor rectangular bounds, call:
1187e5c31af7Sopenharmony_ci
1188e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetScissorWithCountEXT.txt[]
1189e5c31af7Sopenharmony_ci
1190e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
1191e5c31af7Sopenharmony_ci    recorded.
1192e5c31af7Sopenharmony_ci  * pname:scissorCount specifies the scissor count.
1193e5c31af7Sopenharmony_ci  * pname:pScissors specifies the scissors to use for drawing.
1194e5c31af7Sopenharmony_ci
1195e5c31af7Sopenharmony_ciThis command sets the scissor count and scissor rectangular bounds state for
1196e5c31af7Sopenharmony_cisubsequence drawing commands when the graphics pipeline is created with
1197e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT set in
1198e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
1199e5c31af7Sopenharmony_ciOtherwise, this state is specified by the corresponding
1200e5c31af7Sopenharmony_cislink:VkPipelineViewportStateCreateInfo::pname:scissorCount and
1201e5c31af7Sopenharmony_cipname:pScissors values used to create the currently active pipeline.
1202e5c31af7Sopenharmony_ci
1203e5c31af7Sopenharmony_ci.Valid Usage
1204e5c31af7Sopenharmony_ci****
1205e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetScissorWithCountEXT-None-03396]]
1206e5c31af7Sopenharmony_ci    The <<features-extendedDynamicState, extendedDynamicState>> feature
1207e5c31af7Sopenharmony_ci    must: be enabled
1208e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetScissorWithCountEXT-scissorCount-03397]]
1209e5c31af7Sopenharmony_ci    pname:scissorCount must: be between `1` and
1210e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxViewports, inclusive
1211e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetScissorWithCountEXT-scissorCount-03398]]
1212e5c31af7Sopenharmony_ci    If the <<features-multiViewport,multiple viewports>> feature is not
1213e5c31af7Sopenharmony_ci    enabled, pname:scissorCount must: be `1`
1214e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetScissorWithCountEXT-x-03399]]
1215e5c31af7Sopenharmony_ci    The pname:x and pname:y members of pname:offset member of any element of
1216e5c31af7Sopenharmony_ci    pname:pScissors must: be greater than or equal to `0`
1217e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetScissorWithCountEXT-offset-03400]]
1218e5c31af7Sopenharmony_ci    Evaluation of [eq]#(pname:offset.x {plus} pname:extent.width)# must: not
1219e5c31af7Sopenharmony_ci    cause a signed integer addition overflow for any element of
1220e5c31af7Sopenharmony_ci    pname:pScissors
1221e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetScissorWithCountEXT-offset-03401]]
1222e5c31af7Sopenharmony_ci    Evaluation of [eq]#(pname:offset.y {plus} pname:extent.height)# must:
1223e5c31af7Sopenharmony_ci    not cause a signed integer addition overflow for any element of
1224e5c31af7Sopenharmony_ci    pname:pScissors
1225e5c31af7Sopenharmony_ciifdef::VK_NV_inherited_viewport_scissor[]
1226e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetScissorWithCountEXT-commandBuffer-04820]]
1227e5c31af7Sopenharmony_ci    pname:commandBuffer must: not have
1228e5c31af7Sopenharmony_ci    slink:VkCommandBufferInheritanceViewportScissorInfoNV::pname:viewportScissor2D
1229e5c31af7Sopenharmony_ci    enabled
1230e5c31af7Sopenharmony_ciendif::VK_NV_inherited_viewport_scissor[]
1231e5c31af7Sopenharmony_ci****
1232e5c31af7Sopenharmony_ci
1233e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetScissorWithCountEXT.txt[]
1234e5c31af7Sopenharmony_ci--
1235e5c31af7Sopenharmony_ciendif::VK_EXT_extended_dynamic_state[]
1236e5c31af7Sopenharmony_ci
1237e5c31af7Sopenharmony_ci[open,refpage='VkPipelineViewportStateCreateFlags',desc='Reserved for future use',type='flags']
1238e5c31af7Sopenharmony_ci--
1239e5c31af7Sopenharmony_ciinclude::{generated}/api/flags/VkPipelineViewportStateCreateFlags.txt[]
1240e5c31af7Sopenharmony_ci
1241e5c31af7Sopenharmony_citname:VkPipelineViewportStateCreateFlags is a bitmask type for setting a
1242e5c31af7Sopenharmony_cimask, but is currently reserved for future use.
1243e5c31af7Sopenharmony_ci--
1244e5c31af7Sopenharmony_ci
1245e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[]
1246e5c31af7Sopenharmony_ciIf a geometry shader is active and has an output variable decorated with
1247e5c31af7Sopenharmony_cicode:ViewportIndex, the viewport transformation uses the viewport
1248e5c31af7Sopenharmony_cicorresponding to the value assigned to code:ViewportIndex taken from an
1249e5c31af7Sopenharmony_ciimplementation-dependent vertex of each primitive.
1250e5c31af7Sopenharmony_ciIf code:ViewportIndex is outside the range zero to pname:viewportCount minus
1251e5c31af7Sopenharmony_cione for a primitive, or if the geometry shader did not assign a value to
1252e5c31af7Sopenharmony_cicode:ViewportIndex for all vertices of a primitive due to flow control, the
1253e5c31af7Sopenharmony_civalues resulting from the viewport transformation of the vertices of such
1254e5c31af7Sopenharmony_ciprimitives are undefined:.
1255e5c31af7Sopenharmony_ciIf no geometry shader is active, or if the geometry shader does not have an
1256e5c31af7Sopenharmony_cioutput decorated with code:ViewportIndex, the viewport numbered zero is used
1257e5c31af7Sopenharmony_ciby the viewport transformation.
1258e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[]
1259e5c31af7Sopenharmony_ci
1260e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[]
1261e5c31af7Sopenharmony_ciifdef::VK_NV_viewport_array2[]
1262e5c31af7Sopenharmony_ciA _<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
1263e5c31af7Sopenharmony_cistage>>_ can: direct each primitive to zero or more viewports.
1264e5c31af7Sopenharmony_ciThe destination viewports for a primitive are selected by the last active
1265e5c31af7Sopenharmony_ci<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
1266e5c31af7Sopenharmony_cistage>> that has an output variable decorated with code:ViewportIndex
1267e5c31af7Sopenharmony_ci(selecting a single viewport) or code:ViewportMaskNV (selecting multiple
1268e5c31af7Sopenharmony_civiewports).
1269e5c31af7Sopenharmony_ciThe viewport transform uses the viewport corresponding to either the value
1270e5c31af7Sopenharmony_ciassigned to code:ViewportIndex or one of the bits set in
1271e5c31af7Sopenharmony_cicode:ViewportMaskNV, and taken from an implementation-dependent vertex of
1272e5c31af7Sopenharmony_cieach primitive.
1273e5c31af7Sopenharmony_ciIf code:ViewportIndex or any of the bits in code:ViewportMaskNV are outside
1274e5c31af7Sopenharmony_cithe range zero to pname:viewportCount minus one for a primitive, or if the
1275e5c31af7Sopenharmony_cilast active <<pipeline-graphics-subsets-pre-rasterization,pre-rasterization
1276e5c31af7Sopenharmony_cishader stage>> did not assign a value to either code:ViewportIndex or
1277e5c31af7Sopenharmony_cicode:ViewportMaskNV for all vertices of a primitive due to flow control, the
1278e5c31af7Sopenharmony_civalues resulting from the viewport transformation of the vertices of such
1279e5c31af7Sopenharmony_ciprimitives are undefined:.
1280e5c31af7Sopenharmony_ciIf the last <<pipeline-graphics-subsets-pre-rasterization,pre-rasterization
1281e5c31af7Sopenharmony_cishader stage>> does not have an output decorated with code:ViewportIndex or
1282e5c31af7Sopenharmony_cicode:ViewportMaskNV, the viewport numbered zero is used by the viewport
1283e5c31af7Sopenharmony_citransformation.
1284e5c31af7Sopenharmony_ciendif::VK_NV_viewport_array2[]
1285e5c31af7Sopenharmony_ciifndef::VK_NV_viewport_array2[]
1286e5c31af7Sopenharmony_ciA _<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
1287e5c31af7Sopenharmony_cistage>>_ can: direct each primitive to one of several viewports.
1288e5c31af7Sopenharmony_ciThe destination viewport for a primitive is selected by the last active
1289e5c31af7Sopenharmony_ci<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
1290e5c31af7Sopenharmony_cistage>> that has an output variable decorated with code:ViewportIndex.
1291e5c31af7Sopenharmony_ciThe viewport transform uses the viewport corresponding to the value assigned
1292e5c31af7Sopenharmony_cito code:ViewportIndex, and taken from an implementation-dependent vertex of
1293e5c31af7Sopenharmony_cieach primitive.
1294e5c31af7Sopenharmony_ciIf code:ViewportIndex is outside the range zero to pname:viewportCount minus
1295e5c31af7Sopenharmony_cione for a primitive, or if the last active
1296e5c31af7Sopenharmony_ci<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
1297e5c31af7Sopenharmony_cistage>> did not assign a value to code:ViewportIndex for all vertices of a
1298e5c31af7Sopenharmony_ciprimitive due to flow control, the values resulting from the viewport
1299e5c31af7Sopenharmony_citransformation of the vertices of such primitives are undefined:.
1300e5c31af7Sopenharmony_ciIf the last <<pipeline-graphics-subsets-pre-rasterization,pre-rasterization
1301e5c31af7Sopenharmony_cishader stage>> does not have an output decorated with code:ViewportIndex,
1302e5c31af7Sopenharmony_cithe viewport numbered zero is used by the viewport transformation.
1303e5c31af7Sopenharmony_ciendif::VK_NV_viewport_array2[]
1304e5c31af7Sopenharmony_ciendif::VK_VERSION_1_2,VK_EXT_shader_viewport_index_layer,VK_NV_viewport_array2[]
1305e5c31af7Sopenharmony_ci
1306e5c31af7Sopenharmony_ciA single vertex can: be used in more than one individual primitive, in
1307e5c31af7Sopenharmony_ciprimitives such as ename:VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP.
1308e5c31af7Sopenharmony_ciIn this case, the viewport transformation is applied separately for each
1309e5c31af7Sopenharmony_ciprimitive.
1310e5c31af7Sopenharmony_ci
1311e5c31af7Sopenharmony_ci[open,refpage='vkCmdSetViewport',desc='Set the viewport dynamically for a command buffer',type='protos']
1312e5c31af7Sopenharmony_ci--
1313e5c31af7Sopenharmony_ciTo <<pipelines-dynamic-state, dynamically set>> the viewport transformation
1314e5c31af7Sopenharmony_ciparameters, call:
1315e5c31af7Sopenharmony_ci
1316e5c31af7Sopenharmony_ciinclude::{generated}/api/protos/vkCmdSetViewport.txt[]
1317e5c31af7Sopenharmony_ci
1318e5c31af7Sopenharmony_ci  * pname:commandBuffer is the command buffer into which the command will be
1319e5c31af7Sopenharmony_ci    recorded.
1320e5c31af7Sopenharmony_ci  * pname:firstViewport is the index of the first viewport whose parameters
1321e5c31af7Sopenharmony_ci    are updated by the command.
1322e5c31af7Sopenharmony_ci  * pname:viewportCount is the number of viewports whose parameters are
1323e5c31af7Sopenharmony_ci    updated by the command.
1324e5c31af7Sopenharmony_ci  * pname:pViewports is a pointer to an array of slink:VkViewport structures
1325e5c31af7Sopenharmony_ci    specifying viewport parameters.
1326e5c31af7Sopenharmony_ci
1327e5c31af7Sopenharmony_ciThis command sets the viewport transformation parameters state for
1328e5c31af7Sopenharmony_cisubsequent drawing commands when the graphics pipeline is created with
1329e5c31af7Sopenharmony_ciename:VK_DYNAMIC_STATE_VIEWPORT set in
1330e5c31af7Sopenharmony_cislink:VkPipelineDynamicStateCreateInfo::pname:pDynamicStates.
1331e5c31af7Sopenharmony_ciOtherwise, this state is specified by the
1332e5c31af7Sopenharmony_cisname:VkPipelineViewportStateCreateInfo::pname:pViewports values used to
1333e5c31af7Sopenharmony_cicreate the currently active pipeline.
1334e5c31af7Sopenharmony_ci
1335e5c31af7Sopenharmony_ciThe viewport parameters taken from element [eq]#i# of pname:pViewports
1336e5c31af7Sopenharmony_cireplace the current state for the viewport index [eq]#pname:firstViewport
1337e5c31af7Sopenharmony_ci{plus} i#, for [eq]#i# in [eq]#[0, pname:viewportCount)#.
1338e5c31af7Sopenharmony_ci
1339e5c31af7Sopenharmony_ci.Valid Usage
1340e5c31af7Sopenharmony_ci****
1341e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetViewport-firstViewport-01223]]
1342e5c31af7Sopenharmony_ci    The sum of pname:firstViewport and pname:viewportCount must: be between
1343e5c31af7Sopenharmony_ci    `1` and sname:VkPhysicalDeviceLimits::pname:maxViewports, inclusive
1344e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetViewport-firstViewport-01224]]
1345e5c31af7Sopenharmony_ci    If the <<features-multiViewport,multiple viewports>> feature is not
1346e5c31af7Sopenharmony_ci    enabled, pname:firstViewport must: be `0`
1347e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetViewport-viewportCount-01225]]
1348e5c31af7Sopenharmony_ci    If the <<features-multiViewport,multiple viewports>> feature is not
1349e5c31af7Sopenharmony_ci    enabled, pname:viewportCount must: be `1`
1350e5c31af7Sopenharmony_ciifdef::VK_NV_inherited_viewport_scissor[]
1351e5c31af7Sopenharmony_ci  * [[VUID-vkCmdSetViewport-commandBuffer-04821]]
1352e5c31af7Sopenharmony_ci    pname:commandBuffer must: not have
1353e5c31af7Sopenharmony_ci    slink:VkCommandBufferInheritanceViewportScissorInfoNV::pname:viewportScissor2D
1354e5c31af7Sopenharmony_ci    enabled
1355e5c31af7Sopenharmony_ciendif::VK_NV_inherited_viewport_scissor[]
1356e5c31af7Sopenharmony_ci****
1357e5c31af7Sopenharmony_ci
1358e5c31af7Sopenharmony_ciinclude::{generated}/validity/protos/vkCmdSetViewport.txt[]
1359e5c31af7Sopenharmony_ci--
1360e5c31af7Sopenharmony_ci
1361e5c31af7Sopenharmony_ciBoth slink:VkPipelineViewportStateCreateInfo and flink:vkCmdSetViewport use
1362e5c31af7Sopenharmony_cisname:VkViewport to set the viewport transformation parameters.
1363e5c31af7Sopenharmony_ci
1364e5c31af7Sopenharmony_ci[open,refpage='VkViewport',desc='Structure specifying a viewport',type='structs']
1365e5c31af7Sopenharmony_ci--
1366e5c31af7Sopenharmony_ciThe sname:VkViewport structure is defined as:
1367e5c31af7Sopenharmony_ci
1368e5c31af7Sopenharmony_ciinclude::{generated}/api/structs/VkViewport.txt[]
1369e5c31af7Sopenharmony_ci
1370e5c31af7Sopenharmony_ci  * pname:x and pname:y are the viewport's upper left corner [eq]#(x,y)#.
1371e5c31af7Sopenharmony_ci  * pname:width and pname:height are the viewport's width and height,
1372e5c31af7Sopenharmony_ci    respectively.
1373e5c31af7Sopenharmony_ci  * pname:minDepth and pname:maxDepth are the depth range for the viewport.
1374e5c31af7Sopenharmony_ci
1375e5c31af7Sopenharmony_ci[NOTE]
1376e5c31af7Sopenharmony_ci.Note
1377e5c31af7Sopenharmony_ci====
1378e5c31af7Sopenharmony_ciDespite their names, pname:minDepth can: be less than, equal to, or greater
1379e5c31af7Sopenharmony_cithan pname:maxDepth.
1380e5c31af7Sopenharmony_ci====
1381e5c31af7Sopenharmony_ci
1382e5c31af7Sopenharmony_ciThe framebuffer depth coordinate [eq]#pname:z~f~# may: be represented using
1383e5c31af7Sopenharmony_cieither a fixed-point or floating-point representation.
1384e5c31af7Sopenharmony_ciHowever, a floating-point representation must: be used if the depth/stencil
1385e5c31af7Sopenharmony_ciattachment has a floating-point depth component.
1386e5c31af7Sopenharmony_ciIf an [eq]#m#-bit fixed-point representation is used, we assume that it
1387e5c31af7Sopenharmony_cirepresents each value latexmath:[\frac{k}{2^m - 1}], where [eq]#k {elem} {
1388e5c31af7Sopenharmony_ci0, 1, ..., 2^m^-1 }#, as [eq]#k# (e.g. 1.0 is represented in binary as a
1389e5c31af7Sopenharmony_cistring of all ones).
1390e5c31af7Sopenharmony_ci
1391e5c31af7Sopenharmony_ciThe viewport parameters shown in the above equations are found from these
1392e5c31af7Sopenharmony_civalues as
1393e5c31af7Sopenharmony_ci
1394e5c31af7Sopenharmony_ci  {empty}:: [eq]#o~x~ = pname:x {plus} pname:width / 2#
1395e5c31af7Sopenharmony_ci  {empty}:: [eq]#o~y~ = pname:y {plus} pname:height / 2#
1396e5c31af7Sopenharmony_ci  {empty}:: [eq]#o~z~ = pname:minDepth#
1397e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~x~ = pname:width#
1398e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~y~ = pname:height#
1399e5c31af7Sopenharmony_ci  {empty}:: [eq]#p~z~ = pname:maxDepth - pname:minDepth#.
1400e5c31af7Sopenharmony_ci
1401e5c31af7Sopenharmony_ciifdef::VK_QCOM_render_pass_transform[]
1402e5c31af7Sopenharmony_ciIf a render pass transform is enabled, the values [eq]#(p~x~,p~y~)# and
1403e5c31af7Sopenharmony_ci[eq]#(o~x~, o~y~)# defining the viewport are transformed as described in
1404e5c31af7Sopenharmony_ci<<vertexpostproc-renderpass-transform, render pass transform>> before
1405e5c31af7Sopenharmony_ciparticipating in the viewport transform.
1406e5c31af7Sopenharmony_ciendif::VK_QCOM_render_pass_transform[]
1407e5c31af7Sopenharmony_ci
1408e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance1[]
1409e5c31af7Sopenharmony_ciThe application can: specify a negative term for pname:height, which has the
1410e5c31af7Sopenharmony_cieffect of negating the y coordinate in clip space before performing the
1411e5c31af7Sopenharmony_citransform.
1412e5c31af7Sopenharmony_ciWhen using a negative pname:height, the application should: also adjust the
1413e5c31af7Sopenharmony_cipname:y value to point to the lower left corner of the viewport instead of
1414e5c31af7Sopenharmony_cithe upper left corner.
1415e5c31af7Sopenharmony_ciUsing the negative pname:height allows the application to avoid having to
1416e5c31af7Sopenharmony_cinegate the y component of the code:Position output from the last
1417e5c31af7Sopenharmony_ci<<pipeline-graphics-subsets-pre-rasterization,pre-rasterization shader
1418e5c31af7Sopenharmony_cistage>>.
1419e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance1[]
1420e5c31af7Sopenharmony_ci
1421e5c31af7Sopenharmony_ciThe width and height of the <<limits-maxViewportDimensions,
1422e5c31af7Sopenharmony_ciimplementation-dependent maximum viewport dimensions>> must: be greater than
1423e5c31af7Sopenharmony_cior equal to the width and height of the largest image which can: be created
1424e5c31af7Sopenharmony_ciand attached to a framebuffer.
1425e5c31af7Sopenharmony_ci
1426e5c31af7Sopenharmony_ciThe floating-point viewport bounds are represented with an
1427e5c31af7Sopenharmony_ci<<limits-viewportSubPixelBits,implementation-dependent precision>>.
1428e5c31af7Sopenharmony_ci
1429e5c31af7Sopenharmony_ci.Valid Usage
1430e5c31af7Sopenharmony_ci****
1431e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-width-01770]]
1432e5c31af7Sopenharmony_ci    pname:width must: be greater than `0.0`
1433e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-width-01771]]
1434e5c31af7Sopenharmony_ci    pname:width must: be less than or equal to
1435e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxViewportDimensions[0]
1436e5c31af7Sopenharmony_ciifndef::VK_VERSION_1_1,VK_KHR_maintenance1,VK_AMD_negative_viewport_height[]
1437e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-height-01772]]
1438e5c31af7Sopenharmony_ci    pname:height must: be greater than `0.0`
1439e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance1,VK_AMD_negative_viewport_height[]
1440e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-height-01773]]
1441e5c31af7Sopenharmony_ci    The absolute value of pname:height must: be less than or equal to
1442e5c31af7Sopenharmony_ci    sname:VkPhysicalDeviceLimits::pname:maxViewportDimensions[1]
1443e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-x-01774]]
1444e5c31af7Sopenharmony_ci    pname:x must: be greater than or equal to pname:viewportBoundsRange[0]
1445e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-x-01232]]
1446e5c31af7Sopenharmony_ci    [eq]#(pname:x {plus} pname:width)# must: be less than or equal to
1447e5c31af7Sopenharmony_ci    pname:viewportBoundsRange[1]
1448e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-y-01775]]
1449e5c31af7Sopenharmony_ci    pname:y must: be greater than or equal to pname:viewportBoundsRange[0]
1450e5c31af7Sopenharmony_ciifdef::VK_VERSION_1_1,VK_KHR_maintenance1,VK_AMD_negative_viewport_height[]
1451e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-y-01776]]
1452e5c31af7Sopenharmony_ci    pname:y must: be less than or equal to pname:viewportBoundsRange[1]
1453e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-y-01777]]
1454e5c31af7Sopenharmony_ci    [eq]#(pname:y {plus} pname:height)# must: be greater than or equal to
1455e5c31af7Sopenharmony_ci    pname:viewportBoundsRange[0]
1456e5c31af7Sopenharmony_ciendif::VK_VERSION_1_1,VK_KHR_maintenance1,VK_AMD_negative_viewport_height[]
1457e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-y-01233]]
1458e5c31af7Sopenharmony_ci    [eq]#(pname:y {plus} pname:height)# must: be less than or equal to
1459e5c31af7Sopenharmony_ci    pname:viewportBoundsRange[1]
1460e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[]
1461e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-minDepth-01234]]
1462e5c31af7Sopenharmony_ci    Unless `apiext:VK_EXT_depth_range_unrestricted` extension is enabled
1463e5c31af7Sopenharmony_ci    pname:minDepth must: be between `0.0` and `1.0`, inclusive
1464e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[]
1465e5c31af7Sopenharmony_ciifndef::VK_EXT_depth_range_unrestricted[]
1466e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-minDepth-02540]]
1467e5c31af7Sopenharmony_ci    pname:minDepth must: be between `0.0` and `1.0`, inclusive
1468e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[]
1469e5c31af7Sopenharmony_ciifdef::VK_EXT_depth_range_unrestricted[]
1470e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-maxDepth-01235]]
1471e5c31af7Sopenharmony_ci    Unless `apiext:VK_EXT_depth_range_unrestricted` extension is enabled
1472e5c31af7Sopenharmony_ci    pname:maxDepth must: be between `0.0` and `1.0`, inclusive
1473e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[]
1474e5c31af7Sopenharmony_ciifndef::VK_EXT_depth_range_unrestricted[]
1475e5c31af7Sopenharmony_ci  * [[VUID-VkViewport-maxDepth-02541]]
1476e5c31af7Sopenharmony_ci    pname:maxDepth must: be between `0.0` and `1.0`, inclusive
1477e5c31af7Sopenharmony_ciendif::VK_EXT_depth_range_unrestricted[]
1478e5c31af7Sopenharmony_ci****
1479e5c31af7Sopenharmony_ci
1480e5c31af7Sopenharmony_ciinclude::{generated}/validity/structs/VkViewport.txt[]
1481e5c31af7Sopenharmony_ci--
1482