text:
## 27. Fixed-Function Vertex Post-Processing

After pre-rasterization shader stages, the following fixed-function operations are applied to vertices of the resulting primitives:

Next, rasterization is performed on primitives as described in chapter Rasterization.

### 27.1. Transform Feedback

Before any other fixed-function vertex post-processing, vertex outputs from the last shader in the pre-rasterization shader stage can be written out to one or more transform feedback buffers bound to the command buffer. To capture vertex outputs the last pre-rasterization shader stage shader must be declared with the Xfb execution mode. Outputs decorated with XfbBuffer will be written out to the corresponding transform feedback buffers bound to the command buffer when transform feedback is active. Transform feedback buffers are bound to the command buffer by using vkCmdBindTransformFeedbackBuffersEXT. Transform feedback is made active by calling vkCmdBeginTransformFeedbackEXT and made inactive by calling vkCmdEndTransformFeedbackEXT. After vertex data is written it is possible to use vkCmdDrawIndirectByteCountEXT to start a new draw where the vertexCount is derived from the number of bytes written by a previous transform feedback.

When an individual point, line, or triangle primitive reaches the transform feedback stage while transform feedback is active, the values of the specified output variables are assembled into primitives and appended to the bound transform feedback buffers. After activating transform feedback, the values of the first assembled primitive are written at the starting offsets of the bound transform feedback buffers, and subsequent primitives are appended to the buffer. If the optional pCounterBuffers and pCounterBufferOffsets parameters are specified, the starting points within the transform feedback buffers are adjusted so data is appended to the previously written values indicated by the value stored by the implementation in the counter buffer.

For multi-vertex primitives, all values for a given vertex are written before writing values for any other vertex. When transformFeedbackPreservesProvokingVertex is not enabled, implementations may write out any vertex within the primitive first, but all subsequent vertices for that primitive must be written out in a consistent winding order defined as follows:

When transformFeedbackPreservesProvokingVertex is enabled, then in addition to writing vertices with a consistent winding order, the vertex order must preserve the provoking vertex of each primitive:

• When the pipeline’s provoking vertex mode is VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT, the primitive’s provoking vertex must be the first vertex written.

• When the pipeline’s provoking vertex mode is VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, the primitive’s provoking vertex must be the last vertex written.

If transformFeedbackPreservesTriangleFanProvokingVertex is VK_FALSE, neither geometry nor tessellation shading is active, and the primitive topology is VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN, then the first vertex written from each primitive is implementation-defined even when transformFeedbackPreservesProvokingVertex is enabled.

When capturing vertices, the stride associated with each transform feedback buffer, as indicated by the XfbStride decoration, indicates the number of bytes of storage reserved for each vertex in the transform feedback buffer. For every vertex captured, each output attribute with a Offset decoration will be written to the storage reserved for the vertex at the associated transform feedback buffer. When writing output variables that are arrays or structures, individual array elements or structure members are written tightly packed in order. For vector types, individual components are written in order. For matrix types, outputs are written as an array of column vectors.

If any component of an output with an assigned transform feedback offset was not written to by its shader, the value recorded for that component is undefined. All components of an output variable must be written at an offset aligned to the size of the component. The size of each component of an output variable must be at least 32-bits. When capturing a vertex, any portion of the reserved storage not associated with an output variable with an assigned transform feedback offset will be unmodified.

When transform feedback is inactive, no vertices are recorded. If there is a valid counter buffer handle and counter buffer offset in the pCounterBuffers and pCounterBufferOffsets arrays, writes to the corresponding transform feedback buffer will start at the byte offset represented by the value stored in the counter buffer location.

Individual lines or triangles of a strip or fan primitive will be extracted and recorded separately. Incomplete primitives are not recorded.

When using a geometry shader that emits vertices to multiple vertex streams, a primitive will be assembled and output for each stream when there are enough vertices emitted for the output primitive type. All outputs assigned to a given transform feedback buffer are required to come from a single vertex stream.

The sizes of the transform feedback buffers are defined by the vkCmdBindTransformFeedbackBuffersEXT pSizes parameter for each of the bound buffers, or the size of the bound buffer, whichever is the lesser. If there is less space remaining in any of the transform feedback buffers than the size of all of the vertex data for that primitive based on the XfbStride for that XfbBuffer then no vertex data of that primitive is recorded in any transform feedback buffer, and the value for the number of primitives written in the corresponding VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT query for all transform feedback buffers is no longer incremented.

Any outputs made to a XfbBuffer that is not bound to a transform feedback buffer is ignored.

To bind transform feedback buffers to a command buffer for use in subsequent drawing commands, call:

// Provided by VK_EXT_transform_feedback
void vkCmdBindTransformFeedbackBuffersEXT(
VkCommandBuffer                             commandBuffer,
uint32_t                                    firstBinding,
uint32_t                                    bindingCount,
const VkBuffer*                             pBuffers,
const VkDeviceSize*                         pOffsets,
const VkDeviceSize*                         pSizes);
• commandBuffer is the command buffer into which the command is recorded.

• firstBinding is the index of the first transform feedback binding whose state is updated by the command.

• bindingCount is the number of transform feedback bindings whose state is updated by the command.

• pBuffers is a pointer to an array of buffer handles.

• pOffsets is a pointer to an array of buffer offsets.

• pSizes is NULL or a pointer to an array of VkDeviceSize buffer sizes, specifying the maximum number of bytes to capture to the corresponding transform feedback buffer. If pSizes is NULL, or the value of the pSizes array element is VK_WHOLE_SIZE, then the maximum number of bytes captured will be the size of the corresponding buffer minus the buffer offset.

The values taken from elements i of pBuffers, pOffsets and pSizes replace the current state for the transform feedback binding firstBinding + i, for i in [0, bindingCount). The transform feedback binding is updated to start at the offset indicated by pOffsets[i] from the start of the buffer pBuffers[i].

Valid Usage
• VUID-vkCmdBindTransformFeedbackBuffersEXT-transformFeedback-02355
VkPhysicalDeviceTransformFeedbackFeaturesEXT::transformFeedback must be enabled

• VUID-vkCmdBindTransformFeedbackBuffersEXT-firstBinding-02356
firstBinding must be less than VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers

• VUID-vkCmdBindTransformFeedbackBuffersEXT-firstBinding-02357
The sum of firstBinding and bindingCount must be less than or equal to VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers

• VUID-vkCmdBindTransformFeedbackBuffersEXT-pOffsets-02358
All elements of pOffsets must be less than the size of the corresponding element in pBuffers

• VUID-vkCmdBindTransformFeedbackBuffersEXT-pOffsets-02359
All elements of pOffsets must be a multiple of 4

• VUID-vkCmdBindTransformFeedbackBuffersEXT-pBuffers-02360
All elements of pBuffers must have been created with the VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT flag

• VUID-vkCmdBindTransformFeedbackBuffersEXT-pSize-02361
If the optional pSize array is specified, each element of pSizes must either be VK_WHOLE_SIZE, or be less than or equal to VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBufferSize

• VUID-vkCmdBindTransformFeedbackBuffersEXT-pSizes-02362
All elements of pSizes must be either VK_WHOLE_SIZE, or less than or equal to the size of the corresponding buffer in pBuffers

• VUID-vkCmdBindTransformFeedbackBuffersEXT-pOffsets-02363
All elements of pOffsets plus pSizes, where the pSizes, element is not VK_WHOLE_SIZE, must be less than or equal to the size of the corresponding buffer in pBuffers

• VUID-vkCmdBindTransformFeedbackBuffersEXT-pBuffers-02364
Each element of pBuffers that is non-sparse must be bound completely and contiguously to a single VkDeviceMemory object

• VUID-vkCmdBindTransformFeedbackBuffersEXT-None-02365
Transform feedback must not be active when the vkCmdBindTransformFeedbackBuffersEXT command is recorded

Valid Usage (Implicit)
• VUID-vkCmdBindTransformFeedbackBuffersEXT-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdBindTransformFeedbackBuffersEXT-pBuffers-parameter
pBuffers must be a valid pointer to an array of bindingCount valid VkBuffer handles

• VUID-vkCmdBindTransformFeedbackBuffersEXT-pOffsets-parameter
pOffsets must be a valid pointer to an array of bindingCount VkDeviceSize values

• VUID-vkCmdBindTransformFeedbackBuffersEXT-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdBindTransformFeedbackBuffersEXT-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdBindTransformFeedbackBuffersEXT-videocoding
This command must only be called outside of a video coding scope

• VUID-vkCmdBindTransformFeedbackBuffersEXT-bindingCount-arraylength
bindingCount must be greater than 0

• VUID-vkCmdBindTransformFeedbackBuffersEXT-commonparent
Both of commandBuffer, and the elements of pBuffers must have been created, allocated, or retrieved from the same VkDevice

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

Transform feedback for specific transform feedback buffers is made active by calling:

// Provided by VK_EXT_transform_feedback
void vkCmdBeginTransformFeedbackEXT(
VkCommandBuffer                             commandBuffer,
uint32_t                                    firstCounterBuffer,
uint32_t                                    counterBufferCount,
const VkBuffer*                             pCounterBuffers,
const VkDeviceSize*                         pCounterBufferOffsets);
• commandBuffer is the command buffer into which the command is recorded.

• firstCounterBuffer is the index of the first transform feedback buffer corresponding to pCounterBuffers[0] and pCounterBufferOffsets[0].

• counterBufferCount is the size of the pCounterBuffers and pCounterBufferOffsets arrays.

• pCounterBuffers is NULL or a pointer to an array of VkBuffer handles to counter buffers. Each buffer contains a 4 byte integer value representing the byte offset from the start of the corresponding transform feedback buffer from where to start capturing vertex data. If the byte offset stored to the counter buffer location was done using vkCmdEndTransformFeedbackEXT it can be used to resume transform feedback from the previous location. If pCounterBuffers is NULL, then transform feedback will start capturing vertex data to byte offset zero in all bound transform feedback buffers. For each element of pCounterBuffers that is VK_NULL_HANDLE, transform feedback will start capturing vertex data to byte zero in the corresponding bound transform feedback buffer.

• pCounterBufferOffsets is NULL or a pointer to an array of VkDeviceSize values specifying offsets within each of the pCounterBuffers where the counter values were previously written. The location in each counter buffer at these offsets must be large enough to contain 4 bytes of data. This data is the number of bytes captured by the previous transform feedback to this buffer. If pCounterBufferOffsets is NULL, then it is assumed the offsets are zero.

The active transform feedback buffers will capture primitives emitted from the corresponding XfbBuffer in the bound graphics pipeline. Any XfbBuffer emitted that does not output to an active transform feedback buffer will not be captured.

Valid Usage
• VUID-vkCmdBeginTransformFeedbackEXT-transformFeedback-02366
VkPhysicalDeviceTransformFeedbackFeaturesEXT::transformFeedback must be enabled

• VUID-vkCmdBeginTransformFeedbackEXT-None-02367
Transform feedback must not be active

• VUID-vkCmdBeginTransformFeedbackEXT-firstCounterBuffer-02368
firstCounterBuffer must be less than VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers

• VUID-vkCmdBeginTransformFeedbackEXT-firstCounterBuffer-02369
The sum of firstCounterBuffer and counterBufferCount must be less than or equal to VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers

• VUID-vkCmdBeginTransformFeedbackEXT-counterBufferCount-02607
If counterBufferCount is not 0, and pCounterBuffers is not NULL, pCounterBuffers must be a valid pointer to an array of counterBufferCount VkBuffer handles that are either valid or VK_NULL_HANDLE

• VUID-vkCmdBeginTransformFeedbackEXT-pCounterBufferOffsets-02370
For each buffer handle in the array, if it is not VK_NULL_HANDLE it must reference a buffer large enough to hold 4 bytes at the corresponding offset from the pCounterBufferOffsets array

• VUID-vkCmdBeginTransformFeedbackEXT-pCounterBuffer-02371
If pCounterBuffer is NULL, then pCounterBufferOffsets must also be NULL

• VUID-vkCmdBeginTransformFeedbackEXT-pCounterBuffers-02372
For each buffer handle in the pCounterBuffers array that is not VK_NULL_HANDLE it must have been created with a usage value containing VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT

• VUID-vkCmdBeginTransformFeedbackEXT-None-06233
A valid graphics pipeline must be bound to VK_PIPELINE_BIND_POINT_GRAPHICS

• VUID-vkCmdBeginTransformFeedbackEXT-None-04128
The last pre-rasterization shader stage of the bound graphics pipeline must have been declared with the Xfb execution mode

• VUID-vkCmdBeginTransformFeedbackEXT-None-02373
Transform feedback must not be made active in a render pass instance with multiview enabled

Valid Usage (Implicit)
• VUID-vkCmdBeginTransformFeedbackEXT-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdBeginTransformFeedbackEXT-pCounterBufferOffsets-parameter
If counterBufferCount is not 0, and pCounterBufferOffsets is not NULL, pCounterBufferOffsets must be a valid pointer to an array of counterBufferCount VkDeviceSize values

• VUID-vkCmdBeginTransformFeedbackEXT-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdBeginTransformFeedbackEXT-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdBeginTransformFeedbackEXT-renderpass
This command must only be called inside of a render pass instance

• VUID-vkCmdBeginTransformFeedbackEXT-videocoding
This command must only be called outside of a video coding scope

• VUID-vkCmdBeginTransformFeedbackEXT-commonparent
Both of commandBuffer, and the elements of pCounterBuffers that are valid handles of non-ignored parameters must have been created, allocated, or retrieved from the same VkDevice

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Inside

Outside

Graphics

State

Transform feedback for specific transform feedback buffers is made inactive by calling:

// Provided by VK_EXT_transform_feedback
void vkCmdEndTransformFeedbackEXT(
VkCommandBuffer                             commandBuffer,
uint32_t                                    firstCounterBuffer,
uint32_t                                    counterBufferCount,
const VkBuffer*                             pCounterBuffers,
const VkDeviceSize*                         pCounterBufferOffsets);
• commandBuffer is the command buffer into which the command is recorded.

• firstCounterBuffer is the index of the first transform feedback buffer corresponding to pCounterBuffers[0] and pCounterBufferOffsets[0].

• counterBufferCount is the size of the pCounterBuffers and pCounterBufferOffsets arrays.

• pCounterBuffers is NULL or a pointer to an array of VkBuffer handles to counter buffers. The counter buffers are used to record the current byte positions of each transform feedback buffer where the next vertex output data would be captured. This can be used by a subsequent vkCmdBeginTransformFeedbackEXT call to resume transform feedback capture from this position. It can also be used by vkCmdDrawIndirectByteCountEXT to determine the vertex count of the draw call.

• pCounterBufferOffsets is NULL or a pointer to an array of VkDeviceSize values specifying offsets within each of the pCounterBuffers where the counter values can be written. The location in each counter buffer at these offsets must be large enough to contain 4 bytes of data. The data stored at this location is the byte offset from the start of the transform feedback buffer binding where the next vertex data would be written. If pCounterBufferOffsets is NULL, then it is assumed the offsets are zero.

Valid Usage
• VUID-vkCmdEndTransformFeedbackEXT-transformFeedback-02374
VkPhysicalDeviceTransformFeedbackFeaturesEXT::transformFeedback must be enabled

• VUID-vkCmdEndTransformFeedbackEXT-None-02375
Transform feedback must be active

• VUID-vkCmdEndTransformFeedbackEXT-firstCounterBuffer-02376
firstCounterBuffer must be less than VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers

• VUID-vkCmdEndTransformFeedbackEXT-firstCounterBuffer-02377
The sum of firstCounterBuffer and counterBufferCount must be less than or equal to VkPhysicalDeviceTransformFeedbackPropertiesEXT::maxTransformFeedbackBuffers

• VUID-vkCmdEndTransformFeedbackEXT-counterBufferCount-02608
If counterBufferCount is not 0, and pCounterBuffers is not NULL, pCounterBuffers must be a valid pointer to an array of counterBufferCount VkBuffer handles that are either valid or VK_NULL_HANDLE

• VUID-vkCmdEndTransformFeedbackEXT-pCounterBufferOffsets-02378
For each buffer handle in the array, if it is not VK_NULL_HANDLE it must reference a buffer large enough to hold 4 bytes at the corresponding offset from the pCounterBufferOffsets array

• VUID-vkCmdEndTransformFeedbackEXT-pCounterBuffer-02379
If pCounterBuffer is NULL, then pCounterBufferOffsets must also be NULL

• VUID-vkCmdEndTransformFeedbackEXT-pCounterBuffers-02380
For each buffer handle in the pCounterBuffers array that is not VK_NULL_HANDLE it must have been created with a usage value containing VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT

Valid Usage (Implicit)
• VUID-vkCmdEndTransformFeedbackEXT-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdEndTransformFeedbackEXT-pCounterBufferOffsets-parameter
If counterBufferCount is not 0, and pCounterBufferOffsets is not NULL, pCounterBufferOffsets must be a valid pointer to an array of counterBufferCount VkDeviceSize values

• VUID-vkCmdEndTransformFeedbackEXT-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdEndTransformFeedbackEXT-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdEndTransformFeedbackEXT-renderpass
This command must only be called inside of a render pass instance

• VUID-vkCmdEndTransformFeedbackEXT-videocoding
This command must only be called outside of a video coding scope

• VUID-vkCmdEndTransformFeedbackEXT-commonparent
Both of commandBuffer, and the elements of pCounterBuffers that are valid handles of non-ignored parameters must have been created, allocated, or retrieved from the same VkDevice

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Inside

Outside

Graphics

State

### 27.2. Viewport Swizzle

Each primitive sent to a given viewport has a swizzle and optional negation applied to its clip coordinates. The swizzle that is applied depends on the viewport index, and is controlled by the VkPipelineViewportSwizzleStateCreateInfoNV pipeline state:

// Provided by VK_NV_viewport_swizzle
typedef struct VkPipelineViewportSwizzleStateCreateInfoNV {
VkStructureType                                sType;
const void*                                    pNext;
VkPipelineViewportSwizzleStateCreateFlagsNV    flags;
uint32_t                                       viewportCount;
const VkViewportSwizzleNV*                     pViewportSwizzles;
} VkPipelineViewportSwizzleStateCreateInfoNV;
• sType is the type of this structure.

• pNext is NULL or a pointer to a structure extending this structure.

• flags is reserved for future use.

• viewportCount is the number of viewport swizzles used by the pipeline.

• pViewportSwizzles is a pointer to an array of VkViewportSwizzleNV structures, defining the viewport swizzles.

Valid Usage
• VUID-VkPipelineViewportSwizzleStateCreateInfoNV-viewportCount-01215
viewportCount must be greater than or equal to the viewportCount set in VkPipelineViewportStateCreateInfo

Valid Usage (Implicit)
• VUID-VkPipelineViewportSwizzleStateCreateInfoNV-sType-sType
sType must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV

flags must be 0

• VUID-VkPipelineViewportSwizzleStateCreateInfoNV-pViewportSwizzles-parameter
pViewportSwizzles must be a valid pointer to an array of viewportCount valid VkViewportSwizzleNV structures

• VUID-VkPipelineViewportSwizzleStateCreateInfoNV-viewportCount-arraylength
viewportCount must be greater than 0

// Provided by VK_NV_viewport_swizzle
typedef VkFlags VkPipelineViewportSwizzleStateCreateFlagsNV;

VkPipelineViewportSwizzleStateCreateFlagsNV is a bitmask type for setting a mask, but is currently reserved for future use.

The VkPipelineViewportSwizzleStateCreateInfoNV state is set by adding this structure to the pNext chain of a VkPipelineViewportStateCreateInfo structure and setting the graphics pipeline state with vkCreateGraphicsPipelines.

To dynamically set the viewport swizzle state, call:

// Provided by VK_EXT_extended_dynamic_state3
void vkCmdSetViewportSwizzleNV(
VkCommandBuffer                             commandBuffer,
uint32_t                                    firstViewport,
uint32_t                                    viewportCount,
const VkViewportSwizzleNV*                  pViewportSwizzles);
• commandBuffer is the command buffer into which the command will be recorded.

• firstViewport is the index of the first viewport whose parameters are updated by the command.

• viewportCount is the number of viewports whose parameters are updated by the command.

• pViewportSwizzles is a pointer to an array of VkViewportSwizzleNV structures specifying viewport swizzles.

This command sets the viewport swizzle state for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_VIEWPORT_SWIZZLE_NV set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineViewportSwizzleStateCreateInfoNV::viewportCount, and VkPipelineViewportSwizzleStateCreateInfoNV::pViewportSwizzles values used to create the currently active pipeline.

Valid Usage
Valid Usage (Implicit)
• VUID-vkCmdSetViewportSwizzleNV-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetViewportSwizzleNV-pViewportSwizzles-parameter
pViewportSwizzles must be a valid pointer to an array of viewportCount valid VkViewportSwizzleNV structures

• VUID-vkCmdSetViewportSwizzleNV-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetViewportSwizzleNV-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetViewportSwizzleNV-videocoding
This command must only be called outside of a video coding scope

• VUID-vkCmdSetViewportSwizzleNV-viewportCount-arraylength
viewportCount must be greater than 0

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

Each viewport specified from 0 to viewportCount - 1 has its x,y,z,w swizzle state set to the corresponding x, y, z and w in the VkViewportSwizzleNV structure. Each component is of type VkViewportCoordinateSwizzleNV, which determines the type of swizzle for that component. The value of x computes the new x component of the position as:

if (x == VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV) x' = x;
if (x == VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV) x' = -x;
if (x == VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV) x' = y;
if (x == VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV) x' = -y;
if (x == VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV) x' = z;
if (x == VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV) x' = -z;
if (x == VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV) x' = w;
if (x == VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV) x' = -w;

Similar selections are performed for the y, z, and w coordinates. This swizzling is applied before clipping and perspective divide. If the swizzle for an active viewport index is not specified, the swizzle for x is VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV, y is VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV, z is VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV and w is VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV.

Viewport swizzle parameters are specified by setting the pNext pointer of VkGraphicsPipelineCreateInfo to point to a VkPipelineViewportSwizzleStateCreateInfoNV structure. VkPipelineViewportSwizzleStateCreateInfoNV uses VkViewportSwizzleNV to set the viewport swizzle parameters.

The VkViewportSwizzleNV structure is defined as:

// Provided by VK_NV_viewport_swizzle
typedef struct VkViewportSwizzleNV {
VkViewportCoordinateSwizzleNV    x;
VkViewportCoordinateSwizzleNV    y;
VkViewportCoordinateSwizzleNV    z;
VkViewportCoordinateSwizzleNV    w;
} VkViewportSwizzleNV;
Valid Usage (Implicit)

Possible values of the VkViewportSwizzleNV::x, y, z, and w members, specifying swizzling of the corresponding components of primitives, are:

// Provided by VK_NV_viewport_swizzle
typedef enum VkViewportCoordinateSwizzleNV {
VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = 0,
VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = 1,
VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = 2,
VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = 3,
VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = 4,
VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = 5,
VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = 6,
VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = 7,
} VkViewportCoordinateSwizzleNV;

These values are described in detail in Viewport Swizzle.

Flat shading a vertex output attribute means to assign all vertices of the primitive the same value for that output. The output values assigned are those of the provoking vertex of the primitive. Flat shading is applied to those vertex attributes that match fragment input attributes which are decorated as Flat.

If neither mesh, geometry nor tessellation shading is active, the provoking vertex is determined by the primitive topology defined by VkPipelineInputAssemblyStateCreateInfo:topology used to execute the drawing command.

If a shader using MeshNV Execution Model is active, the provoking vertex is determined by the primitive topology defined by the OutputPoints, OutputLinesNV, or OutputTrianglesNV execution mode.

If a shader using MeshEXT Execution Model is active, the provoking vertex is determined by the primitive topology defined by the OutputPoints, OutputLinesEXT, or OutputTrianglesEXT execution mode.

If geometry shading is active, the provoking vertex is determined by the primitive topology defined by the OutputPoints, OutputLineStrips, or OutputTriangleStrips execution mode.

If tessellation shading is active but geometry shading is not, the provoking vertex may be any of the vertices in each primitive.

For a given primitive topology, the pipeline’s provoking vertex mode determines which vertex is the provoking vertex. To specify the provoking vertex mode, include a VkPipelineRasterizationProvokingVertexStateCreateInfoEXT structure in the VkPipelineRasterizationStateCreateInfo::pNext chain when creating the pipeline.

The VkPipelineRasterizationProvokingVertexStateCreateInfoEXT structure is defined as:

// Provided by VK_EXT_provoking_vertex
typedef struct VkPipelineRasterizationProvokingVertexStateCreateInfoEXT {
VkStructureType             sType;
const void*                 pNext;
VkProvokingVertexModeEXT    provokingVertexMode;
} VkPipelineRasterizationProvokingVertexStateCreateInfoEXT;
• sType is the type of this structure.

• pNext is NULL or a pointer to a structure extending this structure.

• provokingVertexMode is a VkProvokingVertexModeEXT value selecting the provoking vertex mode.

If this struct is not provided when creating the pipeline, the pipeline will use the VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT mode.

If the provokingVertexModePerPipeline limit is VK_FALSE, then all pipelines bound within a render pass instance must have the same provokingVertexMode.

Valid Usage
• VUID-VkPipelineRasterizationProvokingVertexStateCreateInfoEXT-provokingVertexMode-04883
If provokingVertexMode is VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT, then the provokingVertexLast feature must be enabled

Valid Usage (Implicit)
• VUID-VkPipelineRasterizationProvokingVertexStateCreateInfoEXT-sType-sType
sType must be VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT

• VUID-VkPipelineRasterizationProvokingVertexStateCreateInfoEXT-provokingVertexMode-parameter
provokingVertexMode must be a valid VkProvokingVertexModeEXT value

Possible values of VkPipelineRasterizationProvokingVertexStateCreateInfoEXT::provokingVertexMode are:

// Provided by VK_EXT_provoking_vertex
typedef enum VkProvokingVertexModeEXT {
VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT = 0,
VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT = 1,
} VkProvokingVertexModeEXT;
• VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT specifies that the provoking vertex is the first non-adjacency vertex in the list of vertices used by a primitive.

• VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT specifies that the provoking vertex is the last non-adjacency vertex in the list of vertices used by a primitive.

These modes are described more precisely in Primitive Topologies.

To dynamically set the provokingVertexMode state, call:

// Provided by VK_EXT_extended_dynamic_state3
void vkCmdSetProvokingVertexModeEXT(
VkCommandBuffer                             commandBuffer,
VkProvokingVertexModeEXT                    provokingVertexMode);
• commandBuffer is the command buffer into which the command will be recorded.

• provokingVertexMode specifies the provokingVertexMode state.

This command sets the provokingVertexMode state for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_PROVOKING_VERTEX_MODE_EXT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineRasterizationProvokingVertexStateCreateInfoEXT::provokingVertexMode value used to create the currently active pipeline.

Valid Usage
Valid Usage (Implicit)
• VUID-vkCmdSetProvokingVertexModeEXT-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetProvokingVertexModeEXT-provokingVertexMode-parameter
provokingVertexMode must be a valid VkProvokingVertexModeEXT value

• VUID-vkCmdSetProvokingVertexModeEXT-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetProvokingVertexModeEXT-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetProvokingVertexModeEXT-videocoding
This command must only be called outside of a video coding scope

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

### 27.4. Primitive Clipping

Primitives are culled against the cull volume and then clipped to the clip volume. In clip coordinates, the view volume is defined by:

where if VkPipelineViewportDepthClipControlCreateInfoEXT::negativeOneToOne is VK_TRUE zm is equal to -wc otherwise zm is equal to zero.

This view volume can be further restricted by as many as VkPhysicalDeviceLimits::maxClipDistances client-defined half-spaces.

The cull volume is the intersection of up to VkPhysicalDeviceLimits::maxCullDistances client-defined half-spaces (if no client-defined cull half-spaces are enabled, culling against the cull volume is skipped).

A shader must write a single cull distance for each enabled cull half-space to elements of the CullDistance array. If the cull distance for any enabled cull half-space is negative for all of the vertices of the primitive under consideration, the primitive is discarded. Otherwise the primitive is clipped against the clip volume as defined below.

The clip volume is the intersection of up to VkPhysicalDeviceLimits::maxClipDistances client-defined half-spaces with the view volume (if no client-defined clip half-spaces are enabled, the clip volume is the view volume).

A shader must write a single clip distance for each enabled clip half-space to elements of the ClipDistance array. Clip half-space i is then given by the set of points satisfying the inequality

ci(P) ≥ 0

where ci(P) is the clip distance i at point P. For point primitives, ci(P) is simply the clip distance for the vertex in question. For line and triangle primitives, per-vertex clip distances are interpolated using a weighted mean, with weights derived according to the algorithms described in sections Basic Line Segment Rasterization and Basic Polygon Rasterization, using the perspective interpolation equations.

The number of client-defined clip and cull half-spaces that are enabled is determined by the explicit size of the built-in arrays ClipDistance and CullDistance, respectively, declared as an output in the interface of the entry point of the final shader stage before clipping.

If VkPipelineRasterizationDepthClipStateCreateInfoEXT is present in the graphics pipeline state then depth clipping is disabled if VkPipelineRasterizationDepthClipStateCreateInfoEXT::depthClipEnable is VK_FALSE. Otherwise, if VkPipelineRasterizationDepthClipStateCreateInfoEXT is not present, depth clipping is disabled when VkPipelineRasterizationStateCreateInfo::depthClampEnable is VK_TRUE.

To dynamically set enable or disable depth clamping, call:

// Provided by VK_EXT_extended_dynamic_state3
void vkCmdSetDepthClampEnableEXT(
VkCommandBuffer                             commandBuffer,
VkBool32                                    depthClampEnable);
• commandBuffer is the command buffer into which the command will be recorded.

• depthClampEnable specifies whether depth clamping is enabled.

This command sets whether depth clamping is enabled or disabled for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_DEPTH_CLAMP_ENABLE_EXT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineRasterizationStateCreateInfo::depthClampEnable value used to create the currently active pipeline.

If the depth clamping state is changed dynamically, and the pipeline was not created with VK_DYNAMIC_STATE_DEPTH_CLIP_ENABLE_EXT enabled, then depth clipping is enabled when depth clamping is disabled and vice versa.

Valid Usage
Valid Usage (Implicit)
• VUID-vkCmdSetDepthClampEnableEXT-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetDepthClampEnableEXT-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetDepthClampEnableEXT-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetDepthClampEnableEXT-videocoding
This command must only be called outside of a video coding scope

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

To dynamically set enable or disable depth clipping, call:

// Provided by VK_EXT_extended_dynamic_state3
void vkCmdSetDepthClipEnableEXT(
VkCommandBuffer                             commandBuffer,
VkBool32                                    depthClipEnable);
• commandBuffer is the command buffer into which the command will be recorded.

• depthClipEnable specifies whether depth clipping is enabled.

This command sets whether depth clipping is enabled or disabled for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_DEPTH_CLIP_ENABLE_EXT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineRasterizationDepthClipStateCreateInfoEXT::depthClipEnable value used to create the currently active pipeline, or is set to the inverse of VkPipelineRasterizationStateCreateInfo::depthClampEnable if VkPipelineRasterizationDepthClipStateCreateInfoEXT is not specified.

Valid Usage
Valid Usage (Implicit)
• VUID-vkCmdSetDepthClipEnableEXT-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetDepthClipEnableEXT-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetDepthClipEnableEXT-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetDepthClipEnableEXT-videocoding
This command must only be called outside of a video coding scope

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

When depth clipping is disabled, the plane equation

zm ≤ zc ≤ wc

(see the clip volume definition above) is ignored by view volume clipping (effectively, there is no near or far plane clipping).

If the primitive under consideration is a point or line segment, then clipping passes it unchanged if its vertices lie entirely within the clip volume.

Possible values of VkPhysicalDevicePointClippingProperties::pointClippingBehavior, specifying clipping behavior of a point primitive whose vertex lies outside the clip volume, are:

// Provided by VK_VERSION_1_1
typedef enum VkPointClippingBehavior {
VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES = 0,
VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1,
// Provided by VK_KHR_maintenance2
VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES,
// Provided by VK_KHR_maintenance2
VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR = VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY,
} VkPointClippingBehavior;

or the equivalent

// Provided by VK_KHR_maintenance2
typedef VkPointClippingBehavior VkPointClippingBehaviorKHR;
• VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES specifies that the primitive is discarded if the vertex lies outside any clip plane, including the planes bounding the view volume.

• VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY specifies that the primitive is discarded only if the vertex lies outside any user clip plane.

If either of a line segment’s vertices lie outside of the clip volume, the line segment may be clipped, with new vertex coordinates computed for each vertex that lies outside the clip volume. A clipped line segment endpoint lies on both the original line segment and the boundary of the clip volume.

This clipping produces a value, 0 ≤ t ≤ 1, for each clipped vertex. If the coordinates of a clipped vertex are P and the unclipped line segment’s vertex coordinates are P1 and P2, then t satisfies the following equation

P = t P1 + (1-t) P2.

t is used to clip vertex output attributes as described in Clipping Shader Outputs.

If the primitive is a polygon, it passes unchanged if every one of its edges lies entirely inside the clip volume, and is either clipped or discarded otherwise. If the edges of the polygon intersect the boundary of the clip volume, the intersecting edges are reconnected by new edges that lie along the boundary of the clip volume - in some cases requiring the introduction of new vertices into a polygon.

If a polygon intersects an edge of the clip volume’s boundary, the clipped polygon must include a point on this boundary edge.

Primitives rendered with user-defined half-spaces must satisfy a complementarity criterion. Suppose a series of primitives is drawn where each vertex i has a single specified clip distance di (or a number of similarly specified clip distances, if multiple half-spaces are enabled). Next, suppose that the same series of primitives are drawn again with each such clip distance replaced by -di (and the graphics pipeline is otherwise the same). In this case, primitives must not be missing any pixels, and pixels must not be drawn twice in regions where those primitives are cut by the clip planes.

The VkPipelineViewportDepthClipControlCreateInfoEXT structure is defined as:

// Provided by VK_EXT_depth_clip_control
typedef struct VkPipelineViewportDepthClipControlCreateInfoEXT {
VkStructureType    sType;
const void*        pNext;
VkBool32           negativeOneToOne;
} VkPipelineViewportDepthClipControlCreateInfoEXT;
• sType is the type of this structure.

• pNext is NULL or a pointer to a structure extending this structure.

• negativeOneToOne sets the zm in the view volume to -wc

Valid Usage
• VUID-VkPipelineViewportDepthClipControlCreateInfoEXT-negativeOneToOne-06470
If depthClipControl is not enabled, negativeOneToOne must be VK_FALSE

Valid Usage (Implicit)
• VUID-VkPipelineViewportDepthClipControlCreateInfoEXT-sType-sType
sType must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_DEPTH_CLIP_CONTROL_CREATE_INFO_EXT

To dynamically set negativeOneToOne, call:

// Provided by VK_EXT_extended_dynamic_state3
void vkCmdSetDepthClipNegativeOneToOneEXT(
VkCommandBuffer                             commandBuffer,
VkBool32                                    negativeOneToOne);
• commandBuffer is the command buffer into which the command will be recorded.

• negativeOneToOne specifies the negativeOneToOne state.

This command sets the negativeOneToOne state for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_DEPTH_CLIP_NEGATIVE_ONE_TO_ONE_EXT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineViewportDepthClipControlCreateInfoEXT::negativeOneToOne value used to create the currently active pipeline.

Valid Usage
Valid Usage (Implicit)
• VUID-vkCmdSetDepthClipNegativeOneToOneEXT-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetDepthClipNegativeOneToOneEXT-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetDepthClipNegativeOneToOneEXT-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetDepthClipNegativeOneToOneEXT-videocoding
This command must only be called outside of a video coding scope

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

Next, vertex output attributes are clipped. The output values associated with a vertex that lies within the clip volume are unaffected by clipping. If a primitive is clipped, however, the output values assigned to vertices produced by clipping are clipped.

Let the output values assigned to the two vertices P1 and P2 of an unclipped edge be c1 and c2. The value of t (see Primitive Clipping) for a clipped point P is used to obtain the output value associated with P as

c = t c1 + (1-t) c2.

(Multiplying an output value by a scalar means multiplying each of x, y, z, and w by the scalar.)

Since this computation is performed in clip space before division by wc, clipped output values are perspective-correct.

Polygon clipping creates a clipped vertex along an edge of the clip volume’s boundary. This situation is handled by noting that polygon clipping proceeds by clipping against one half-space at a time. Output value clipping is done in the same way, so that clipped points always occur at the intersection of polygon edges (possibly already clipped) with the clip volume’s boundary.

For vertex output attributes whose matching fragment input attributes are decorated with NoPerspective, the value of t used to obtain the output value associated with P will be adjusted to produce results that vary linearly in framebuffer space.

Output attributes of integer or unsigned integer type must always be flat shaded. Flat shaded attributes are constant over the primitive being rasterized (see Basic Line Segment Rasterization and Basic Polygon Rasterization), and no interpolation is performed. The output value c is taken from either c1 or c2, since flat shading has already occurred and the two values are identical.

### 27.6. Controlling Viewport W Scaling

If viewport W scaling is enabled, the W component of the clip coordinate is modified by the provided coefficients from the corresponding viewport as follows.

wc' = xcoeff xc + ycoeff yc + wc

The VkPipelineViewportWScalingStateCreateInfoNV structure is defined as:

// Provided by VK_NV_clip_space_w_scaling
typedef struct VkPipelineViewportWScalingStateCreateInfoNV {
VkStructureType                sType;
const void*                    pNext;
VkBool32                       viewportWScalingEnable;
uint32_t                       viewportCount;
const VkViewportWScalingNV*    pViewportWScalings;
} VkPipelineViewportWScalingStateCreateInfoNV;
• sType is the type of this structure.

• pNext is NULL or a pointer to a structure extending this structure.

• viewportWScalingEnable controls whether viewport W scaling is enabled.

• viewportCount is the number of viewports used by W scaling, and must match the number of viewports in the pipeline if viewport W scaling is enabled.

• pViewportWScalings is a pointer to an array of VkViewportWScalingNV structures defining the W scaling parameters for the corresponding viewports. If the viewport W scaling state is dynamic, this member is ignored.

Valid Usage (Implicit)
• VUID-VkPipelineViewportWScalingStateCreateInfoNV-sType-sType
sType must be VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV

• VUID-VkPipelineViewportWScalingStateCreateInfoNV-viewportCount-arraylength
viewportCount must be greater than 0

The VkPipelineViewportWScalingStateCreateInfoNV state is set by adding this structure to the pNext chain of a VkPipelineViewportStateCreateInfo structure and setting the graphics pipeline state with vkCreateGraphicsPipelines.

To dynamically set the viewportWScalingEnable state, call:

// Provided by VK_EXT_extended_dynamic_state3
void vkCmdSetViewportWScalingEnableNV(
VkCommandBuffer                             commandBuffer,
VkBool32                                    viewportWScalingEnable);
• commandBuffer is the command buffer into which the command will be recorded.

• viewportWScalingEnable specifies the viewportWScalingEnable state.

This command sets the viewportWScalingEnable state for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_ENABLE_NV set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineViewportWScalingStateCreateInfoNV::viewportWScalingEnable value used to create the currently active pipeline.

Valid Usage
Valid Usage (Implicit)
• VUID-vkCmdSetViewportWScalingEnableNV-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetViewportWScalingEnableNV-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetViewportWScalingEnableNV-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetViewportWScalingEnableNV-videocoding
This command must only be called outside of a video coding scope

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

To dynamically set the viewport W scaling parameters, call:

// Provided by VK_NV_clip_space_w_scaling
void vkCmdSetViewportWScalingNV(
VkCommandBuffer                             commandBuffer,
uint32_t                                    firstViewport,
uint32_t                                    viewportCount,
const VkViewportWScalingNV*                 pViewportWScalings);
• commandBuffer is the command buffer into which the command will be recorded.

• firstViewport is the index of the first viewport whose parameters are updated by the command.

• viewportCount is the number of viewports whose parameters are updated by the command.

• pViewportWScalings is a pointer to an array of VkViewportWScalingNV structures specifying viewport parameters.

The viewport parameters taken from element i of pViewportWScalings replace the current state for the viewport index firstViewport + i, for i in [0, viewportCount).

This command sets the viewport W scaling for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineViewportWScalingStateCreateInfoNV::pViewportWScalings values used to create the currently active pipeline.

Valid Usage
• VUID-vkCmdSetViewportWScalingNV-firstViewport-01324
The sum of firstViewport and viewportCount must be between 1 and VkPhysicalDeviceLimits::maxViewports, inclusive

Valid Usage (Implicit)
• VUID-vkCmdSetViewportWScalingNV-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetViewportWScalingNV-pViewportWScalings-parameter
pViewportWScalings must be a valid pointer to an array of viewportCount VkViewportWScalingNV structures

• VUID-vkCmdSetViewportWScalingNV-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetViewportWScalingNV-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetViewportWScalingNV-videocoding
This command must only be called outside of a video coding scope

• VUID-vkCmdSetViewportWScalingNV-viewportCount-arraylength
viewportCount must be greater than 0

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

Both VkPipelineViewportWScalingStateCreateInfoNV and vkCmdSetViewportWScalingNV use VkViewportWScalingNV to set the viewport transformation parameters.

The VkViewportWScalingNV structure is defined as:

// Provided by VK_NV_clip_space_w_scaling
typedef struct VkViewportWScalingNV {
float    xcoeff;
float    ycoeff;
} VkViewportWScalingNV;
• xcoeff and ycoeff are the viewport’s W scaling factor for x and y respectively.

### 27.7. Coordinate Transformations

Clip coordinates for a vertex result from shader execution, which yields a vertex coordinate Position.

Perspective division on clip coordinates yields normalized device coordinates, followed by a viewport transformation (see Controlling the Viewport) to convert these coordinates into framebuffer coordinates.

If a vertex in clip coordinates has a position given by

then the vertex’s normalized device coordinates are

### 27.8. Render Pass Transform

A render pass transform can be enabled for render pass instances. The clip coordinates (xc, yc) that result from vertex shader execution are transformed by a rotation of 0, 90, 180, or 270 degrees in the XY plane, centered at the origin.

When Render pass transform is enabled, the transform applies to all primitives for all subpasses of the render pass. The transformed vertex in clip coordinates has a position given by

where

• θ is 0 degrees for VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR

• θ is 90 degrees for VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR

• θ is 180 degrees for VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR

• θ is 270 degrees for VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR

The transformed vertex’s normalized device coordinates are

When render pass transform is enabled for a render pass instance, the following additional features are enabled:

• Each VkViewport specified by either VkPipelineViewportStateCreateInfo::pViewports or vkCmdSetViewport will have its width/height (px, py) and its center (ox, oy) similarly transformed by the implementation.

• Each scissor specified by VkPipelineViewportStateCreateInfo::pScissors or vkCmdSetScissor will have its (offsetx, offsety) and (extentx, extenty) similarly transformed by the implementation.

• The renderArea specified in VkCommandBufferInheritanceRenderPassTransformInfoQCOM and VkRenderPassBeginInfo will be similarly transformed by the implementation.

• The (x, y) components of shader variables with built-in decorations FragCoord, SamplePosition, or PointCoord will be similarly transformed by the implementation.

• The (x,y) components of the offset operand of the InterpolateAtOffset extended instruction will be similarly transformed by the implementation.

• The values returned by SPIR-V derivative instructions OpDPdx, OpDPdy, OpDPdxCourse, OpDPdyCourse, OpDPdxFine, OpDPdyFine will be similarly transformed by the implementation.

The net result of the above, is that applications can act as if rendering to a framebuffer oriented with the VkSurfaceCapabilitiesKHR::currentTransform. In other words, applications can act as if the presentation engine will be performing the transformation of the swapchain image after rendering and prior to presentation to the user. In fact, the transformation of the various items cited above are being handled by the implementation as the rendering takes place.

### 27.9. Controlling the Viewport

The viewport transformation is determined by the selected viewport’s width and height in pixels, px and py, respectively, and its center (ox, oy) (also in pixels), as well as its depth range min and max determining a depth range scale value pz and a depth range bias value oz (defined below). The vertex’s framebuffer coordinates (xf, yf, zf) are given by

xf = (px / 2) xd + ox

yf = (py / 2) yd + oy

zf = pz × zd + oz

Multiple viewports are available, numbered zero up to VkPhysicalDeviceLimits::maxViewports minus one. The number of viewports used by a pipeline is controlled by the viewportCount member of the VkPipelineViewportStateCreateInfo structure used in pipeline creation.

xf and yf have limited precision, where the number of fractional bits retained is specified by VkPhysicalDeviceLimits::subPixelPrecisionBits. When rasterizing line segments, the number of fractional bits is specified by VkPhysicalDeviceLineRasterizationPropertiesEXT::lineSubPixelPrecisionBits.

The VkPipelineViewportStateCreateInfo structure is defined as:

// Provided by VK_VERSION_1_0
typedef struct VkPipelineViewportStateCreateInfo {
VkStructureType                       sType;
const void*                           pNext;
VkPipelineViewportStateCreateFlags    flags;
uint32_t                              viewportCount;
const VkViewport*                     pViewports;
uint32_t                              scissorCount;
const VkRect2D*                       pScissors;
} VkPipelineViewportStateCreateInfo;
• sType is the type of this structure.

• pNext is NULL or a pointer to a structure extending this structure.

• flags is reserved for future use.

• viewportCount is the number of viewports used by the pipeline.

• pViewports is a pointer to an array of VkViewport structures, defining the viewport transforms. If the viewport state is dynamic, this member is ignored.

• scissorCount is the number of scissors and must match the number of viewports.

• pScissors is a pointer to an array of VkRect2D structures defining the rectangular bounds of the scissor for the corresponding viewport. If the scissor state is dynamic, this member is ignored.

Valid Usage
• VUID-VkPipelineViewportStateCreateInfo-viewportCount-01216
If the multiViewport feature is not enabled, viewportCount must not be greater than 1

• VUID-VkPipelineViewportStateCreateInfo-scissorCount-01217
If the multiViewport feature is not enabled, scissorCount must not be greater than 1

• VUID-VkPipelineViewportStateCreateInfo-viewportCount-01218
viewportCount must be less than or equal to VkPhysicalDeviceLimits::maxViewports

• VUID-VkPipelineViewportStateCreateInfo-scissorCount-01219
scissorCount must be less than or equal to VkPhysicalDeviceLimits::maxViewports

• VUID-VkPipelineViewportStateCreateInfo-x-02821
The x and y members of offset member of any element of pScissors must be greater than or equal to 0

• VUID-VkPipelineViewportStateCreateInfo-offset-02822
Evaluation of (offset.x + extent.width) must not cause a signed integer addition overflow for any element of pScissors

• VUID-VkPipelineViewportStateCreateInfo-offset-02823
Evaluation of (offset.y + extent.height) must not cause a signed integer addition overflow for any element of pScissors

• VUID-VkPipelineViewportStateCreateInfo-scissorCount-04134
If the graphics pipeline is being created without VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT and VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT set then scissorCount and viewportCount must be identical

• VUID-VkPipelineViewportStateCreateInfo-viewportCount-04135
If the graphics pipeline is being created with VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT set then viewportCount must be 0, otherwise it must be greater than 0

• VUID-VkPipelineViewportStateCreateInfo-scissorCount-04136
If the graphics pipeline is being created with VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT set then scissorCount must be 0, otherwise it must be greater than 0

• VUID-VkPipelineViewportStateCreateInfo-viewportWScalingEnable-01726
If the viewportWScalingEnable member of a VkPipelineViewportWScalingStateCreateInfoNV structure included in the pNext chain is VK_TRUE, the viewportCount member of the VkPipelineViewportWScalingStateCreateInfoNV structure must be greater than or equal to VkPipelineViewportStateCreateInfo::viewportCount

Valid Usage (Implicit)

To dynamically set the viewport count and viewports, call:

// Provided by VK_VERSION_1_3
void vkCmdSetViewportWithCount(
VkCommandBuffer                             commandBuffer,
uint32_t                                    viewportCount,
const VkViewport*                           pViewports);

or the equivalent command

// Provided by VK_EXT_extended_dynamic_state
void vkCmdSetViewportWithCountEXT(
VkCommandBuffer                             commandBuffer,
uint32_t                                    viewportCount,
const VkViewport*                           pViewports);
• commandBuffer is the command buffer into which the command will be recorded.

• viewportCount specifies the viewport count.

• pViewports specifies the viewports to use for drawing.

This command sets the viewport count and viewports state for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the corresponding VkPipelineViewportStateCreateInfo::viewportCount and pViewports values used to create the currently active pipeline.

Valid Usage
• VUID-vkCmdSetViewportWithCount-viewportCount-03394
viewportCount must be between 1 and VkPhysicalDeviceLimits::maxViewports, inclusive

• VUID-vkCmdSetViewportWithCount-viewportCount-03395
If the multiViewport feature is not enabled, viewportCount must be 1

• VUID-vkCmdSetViewportWithCount-commandBuffer-04819
commandBuffer must not have VkCommandBufferInheritanceViewportScissorInfoNV::viewportScissor2D enabled

Valid Usage (Implicit)
• VUID-vkCmdSetViewportWithCount-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetViewportWithCount-pViewports-parameter
pViewports must be a valid pointer to an array of viewportCount valid VkViewport structures

• VUID-vkCmdSetViewportWithCount-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetViewportWithCount-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetViewportWithCount-videocoding
This command must only be called outside of a video coding scope

• VUID-vkCmdSetViewportWithCount-viewportCount-arraylength
viewportCount must be greater than 0

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

To dynamically set the scissor count and scissor rectangular bounds, call:

// Provided by VK_VERSION_1_3
void vkCmdSetScissorWithCount(
VkCommandBuffer                             commandBuffer,
uint32_t                                    scissorCount,
const VkRect2D*                             pScissors);

or the equivalent command

// Provided by VK_EXT_extended_dynamic_state
void vkCmdSetScissorWithCountEXT(
VkCommandBuffer                             commandBuffer,
uint32_t                                    scissorCount,
const VkRect2D*                             pScissors);
• commandBuffer is the command buffer into which the command will be recorded.

• scissorCount specifies the scissor count.

• pScissors specifies the scissors to use for drawing.

This command sets the scissor count and scissor rectangular bounds state for subsequence drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the corresponding VkPipelineViewportStateCreateInfo::scissorCount and pScissors values used to create the currently active pipeline.

Valid Usage
• VUID-vkCmdSetScissorWithCount-scissorCount-03397
scissorCount must be between 1 and VkPhysicalDeviceLimits::maxViewports, inclusive

• VUID-vkCmdSetScissorWithCount-scissorCount-03398
If the multiViewport feature is not enabled, scissorCount must be 1

• VUID-vkCmdSetScissorWithCount-x-03399
The x and y members of offset member of any element of pScissors must be greater than or equal to 0

• VUID-vkCmdSetScissorWithCount-offset-03400
Evaluation of (offset.x + extent.width) must not cause a signed integer addition overflow for any element of pScissors

• VUID-vkCmdSetScissorWithCount-offset-03401
Evaluation of (offset.y + extent.height) must not cause a signed integer addition overflow for any element of pScissors

• VUID-vkCmdSetScissorWithCount-commandBuffer-04820
commandBuffer must not have VkCommandBufferInheritanceViewportScissorInfoNV::viewportScissor2D enabled

Valid Usage (Implicit)
• VUID-vkCmdSetScissorWithCount-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetScissorWithCount-pScissors-parameter
pScissors must be a valid pointer to an array of scissorCount VkRect2D structures

• VUID-vkCmdSetScissorWithCount-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetScissorWithCount-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetScissorWithCount-videocoding
This command must only be called outside of a video coding scope

• VUID-vkCmdSetScissorWithCount-scissorCount-arraylength
scissorCount must be greater than 0

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

// Provided by VK_VERSION_1_0
typedef VkFlags VkPipelineViewportStateCreateFlags;

VkPipelineViewportStateCreateFlags is a bitmask type for setting a mask, but is currently reserved for future use.

A pre-rasterization shader stage can direct each primitive to zero or more viewports. The destination viewports for a primitive are selected by the last active pre-rasterization shader stage that has an output variable decorated with ViewportIndex (selecting a single viewport) or ViewportMaskNV (selecting multiple viewports). The viewport transform uses the viewport corresponding to either the value assigned to ViewportIndex or one of the bits set in ViewportMaskNV, and taken from an implementation-dependent vertex of each primitive. If ViewportIndex or any of the bits in ViewportMaskNV are outside the range zero to viewportCount minus one for a primitive, or if the last active pre-rasterization shader stage did not assign a value to either ViewportIndex or ViewportMaskNV for all vertices of a primitive due to flow control, the values resulting from the viewport transformation of the vertices of such primitives are undefined. If the last pre-rasterization shader stage does not have an output decorated with ViewportIndex or ViewportMaskNV, the viewport numbered zero is used by the viewport transformation.

A single vertex can be used in more than one individual primitive, in primitives such as VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP. In this case, the viewport transformation is applied separately for each primitive.

To dynamically set the viewport transformation parameters, call:

// Provided by VK_VERSION_1_0
void vkCmdSetViewport(
VkCommandBuffer                             commandBuffer,
uint32_t                                    firstViewport,
uint32_t                                    viewportCount,
const VkViewport*                           pViewports);
• commandBuffer is the command buffer into which the command will be recorded.

• firstViewport is the index of the first viewport whose parameters are updated by the command.

• viewportCount is the number of viewports whose parameters are updated by the command.

• pViewports is a pointer to an array of VkViewport structures specifying viewport parameters.

This command sets the viewport transformation parameters state for subsequent drawing commands when the graphics pipeline is created with VK_DYNAMIC_STATE_VIEWPORT set in VkPipelineDynamicStateCreateInfo::pDynamicStates. Otherwise, this state is specified by the VkPipelineViewportStateCreateInfo::pViewports values used to create the currently active pipeline.

The viewport parameters taken from element i of pViewports replace the current state for the viewport index firstViewport + i, for i in [0, viewportCount).

Valid Usage
• VUID-vkCmdSetViewport-firstViewport-01223
The sum of firstViewport and viewportCount must be between 1 and VkPhysicalDeviceLimits::maxViewports, inclusive

• VUID-vkCmdSetViewport-firstViewport-01224
If the multiViewport feature is not enabled, firstViewport must be 0

• VUID-vkCmdSetViewport-viewportCount-01225
If the multiViewport feature is not enabled, viewportCount must be 1

• VUID-vkCmdSetViewport-commandBuffer-04821
commandBuffer must not have VkCommandBufferInheritanceViewportScissorInfoNV::viewportScissor2D enabled

Valid Usage (Implicit)
• VUID-vkCmdSetViewport-commandBuffer-parameter
commandBuffer must be a valid VkCommandBuffer handle

• VUID-vkCmdSetViewport-pViewports-parameter
pViewports must be a valid pointer to an array of viewportCount valid VkViewport structures

• VUID-vkCmdSetViewport-commandBuffer-recording
commandBuffer must be in the recording state

• VUID-vkCmdSetViewport-commandBuffer-cmdpool
The VkCommandPool that commandBuffer was allocated from must support graphics operations

• VUID-vkCmdSetViewport-videocoding
This command must only be called outside of a video coding scope

• VUID-vkCmdSetViewport-viewportCount-arraylength
viewportCount must be greater than 0

Host Synchronization
• Host access to commandBuffer must be externally synchronized

• Host access to the VkCommandPool that commandBuffer was allocated from must be externally synchronized

Command Properties
Command Buffer Levels Render Pass Scope Video Coding Scope Supported Queue Types Command Type

Primary
Secondary

Both

Outside

Graphics

State

Both VkPipelineViewportStateCreateInfo and vkCmdSetViewport use VkViewport to set the viewport transformation parameters.

The VkViewport structure is defined as:

// Provided by VK_VERSION_1_0
typedef struct VkViewport {
float    x;
float    y;
float    width;
float    height;
float    minDepth;
float    maxDepth;
} VkViewport;
• x and y are the viewport’s upper left corner (x,y).

• width and height are the viewport’s width and height, respectively.

• minDepth and maxDepth are the depth range for the viewport.

 Note Despite their names, minDepth can be less than, equal to, or greater than maxDepth.

The framebuffer depth coordinate zf may be represented using either a fixed-point or floating-point representation. However, a floating-point representation must be used if the depth/stencil attachment has a floating-point depth component. If an m-bit fixed-point representation is used, we assume that it represents each value , where k ∈ { 0, 1, …, 2m-1 }, as k (e.g. 1.0 is represented in binary as a string of all ones).

The viewport parameters shown in the above equations are found from these values as

ox = x + width / 2

oy = y + height / 2

oz = minDepth (or (maxDepth + minDepth) / 2 if VkPipelineViewportDepthClipControlCreateInfoEXT::negativeOneToOne is VK_TRUE)

px = width

py = height

pz = maxDepth - minDepth (or (maxDepth - minDepth) / 2 if VkPipelineViewportDepthClipControlCreateInfoEXT::negativeOneToOne is VK_TRUE)

If a render pass transform is enabled, the values (px,py) and (ox, oy) defining the viewport are transformed as described in render pass transform before participating in the viewport transform.

The application can specify a negative term for height, which has the effect of negating the y coordinate in clip space before performing the transform. When using a negative height, the application should also adjust the y value to point to the lower left corner of the viewport instead of the upper left corner. Using the negative height allows the application to avoid having to negate the y component of the Position output from the last pre-rasterization shader stage.

The width and height of the implementation-dependent maximum viewport dimensions must be greater than or equal to the width and height of the largest image which can be created and attached to a framebuffer.

The floating-point viewport bounds are represented with an implementation-dependent precision.

Valid Usage
• VUID-VkViewport-width-01770
width must be greater than 0.0

• VUID-VkViewport-width-01771
width must be less than or equal to VkPhysicalDeviceLimits::maxViewportDimensions[0]

• VUID-VkViewport-apiVersion-07917
If the VK_KHR_maintenance1 extension is not enabled, the VK_AMD_negative_viewport_height extension is not enabled, and VkPhysicalDeviceProperties::apiVersion is less than Vulkan 1.1, height must be greater than 0.0

• VUID-VkViewport-height-01773
The absolute value of height must be less than or equal to VkPhysicalDeviceLimits::maxViewportDimensions[1]

• VUID-VkViewport-x-01774
x must be greater than or equal to viewportBoundsRange[0]

• VUID-VkViewport-x-01232
(x + width) must be less than or equal to viewportBoundsRange[1]

• VUID-VkViewport-y-01775
y must be greater than or equal to viewportBoundsRange[0]

• VUID-VkViewport-y-01776
y must be less than or equal to viewportBoundsRange[1]

• VUID-VkViewport-y-01777
(y + height) must be greater than or equal to viewportBoundsRange[0]

• VUID-VkViewport-y-01233
(y + height) must be less than or equal to viewportBoundsRange[1]

• VUID-VkViewport-minDepth-01234
If the VK_EXT_depth_range_unrestricted extension is not enabled, minDepth must be between 0.0 and 1.0, inclusive

• VUID-VkViewport-maxDepth-01235
If the VK_EXT_depth_range_unrestricted extension is not enabled, maxDepth must be between 0.0 and 1.0, inclusive


text:
בס''ד

# The Question

A Rubik's cube is a 3x3x3 game that illustrates easily certain group-theory and other mathematical concepts in its solution, as can be seen from this picture:

The usual idea of the game is to rotate various sides until the cube has each side with just one color (of six) and all sides are solved.

The cube can get mixed up to varying degrees. How can it be easily proved - what is the minimum number of moves needed to solve any cube configuration using any number of these cube side rotation moves to scramble it?

The first thing to notice is that the same scrambling and fixing rotations can be applied to the 2x2x2 version of the Rubik's cube called the Pocket Cube:

Then its solution is also the solution to the corner cubes of the full 3x3x3 Rubik's Cube.

Any solution of the full Rubik's Cube must solve the equivalent 2x2x2 Pocket Cube problem.

The 2x2x2 Pocket Cube only has $8*7*6*5*4*3*2*1$ solution states at most, so it is readily amenable to use computer code to find its "eigen-rotations", rotations that produce unique combinations.

Then the number of possibilities needing consideration for the full cube problem is very much restricted to only those also solving the 2x2x2 problem, making those also amenable to computer computation!

## closed as unclear what you're asking by mercio, Namaste, Lord Shark the Unknown, mlc, hardmathJun 21 '17 at 21:04

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• something is wrong with the links: only the first one is actually a link to somewhere – Vincent Jun 21 '17 at 9:32
• Originally posted on physics (but closed b/c it's not a question about physics). – Kyle Kanos Jun 21 '17 at 10:06
• Although your post, drawing upon Wikimedia images, is colorful, it is not clear what you are asking. Your reasoning that the $2\times 2\times 2$ "pocket cube" is easier/faster to solve than the $3\times 3\times 3$ "classic" Rubik's Cube is plausible if not terribly rigorous, but it seems you want an audience to admire your insight, rather than the answer to any particular Question. – hardmath Jun 21 '17 at 21:04

it is a non-trivial problem and i dont think there is a way to just easily prove it without doing a large amount of computations.

• As I was typing up my response, I noticed that you posted yours. However, your response is actually not what he was asking for, because if you go to physics.stackexchange.com/questions/340178/…, he already acknowledged cube20.org with a hyperlink in his statement "Google reportedly solved the problem". Therefore, I posted my response. F.Y.I. – Christopher Mowla Jun 21 '17 at 15:48

Nice question.

My response was too long to be a comment, and thus I decided to make a response.

Being experienced with using a 3x3x3 Rubik's Cube solver to create "parity algorithms" for the 4x4x4 Rubik's Cube, I can relate to the notion that this approach can be used to find God's number for the 3x3x3 from solutions to the 2x2x2. However, we cannot generate all 3x3x3 positions with 2x2x2 move sequences of length 20 or less if that is what you are proposing. To further complicate things, I believe it's possible that move sequences which generate completely different 2x2x2 positions will generate the exact same 3x3x3 position. That is, even among the 2x2x2 move sequences we "enumerate" which are of length 20 or less may not be unique as far as the 3x3x3 is concerned.

Firstly, I will provide evidence of the previous statement with a concrete example.

Being experienced with using 3x3x3 solvers to create 4x4x4 "parity algorithms", one day I found something quite interesting. But first note that I can find 4x4x4 parity algorithms without solvers (e.g., most of the algorithms I attributed to my name on this wikipage, besides algorithms confined to the move set < U2,F2,B2,D2,l,r >, I found by hand), and one day I found the 4x4x4 move sequence by hand:

Typically, these type of 4x4x4 algorithms (ones which "flip" a "single" edge and which consist of only of turns which are single slices, i.e., not move sequences like

--another one of my hand-found algs),

one can literally convert all inner single slice turns to outer slice turns to "see" what the 4x4x4 algorithm looks like on the 3x3x3, and vice versa.

If we convert all inner slice turns of (i) to outer face turns as follows, we get the following move sequence. (Click on the move sequence to observe the 3x3x3 position it generates.)

Now, two well-known 4x4x4 "single edge flip" parity algorithm move sequences are the following.

If we convert (iv) to 3x3x3 turns, we get this position, and if we convert (v) to 3x3x3 turns, we get the same position generated by (iv).

Clearly 3x3x3 Rubik's Cube position (iii) is different than 3x3x3 Rubik's Cube position (iv) == Rubik's Cube position (v), but yet, if we convert 3x3x3 Rubik's Cube position (iii), (iv) and (v) to the 4x4x4, we get the same example "single edge flip" position (even on the super/picture 4x4x4 Rubik's Cube).

Now I believe I have made it clear of the possibility of two 2x2x2 move sequences which generate two different 2x2x2 positions can possibly generate the exact same 3x3x3 position. Let me now explain why using various 2x2x2 move sequences to generate all 3x3x3 positions is insufficient.

On August 30, 2013, I made this post on speedsolving.com regarding how to possibly find God's number for the 4x4x4 cube, using 2x2x2 pock cube moves as a basis of the "skeleton" solution of 4x4x4 positions. This was Herbert Kociemba's response to my proposal. He achieved the number, 2,578,606,199,622,633,886,542,987,264, from his generating function (programmed in Mathematica) by picking the coefficient of the x^35 term with his generating function (copy, paste, and run the following code in Mathematica),

gfh[n_, x_] := 3/(6 - 4 (3 x + 1)^(n - 1)) - 1/2

Series[gfh[2, x], {x, 0, 35}]

, where the 2 indicates the cube size (i.e., the 2x2x2), 35 is the length of the move sequence, and the coefficient in front of the x^35 term tells you how many move sequences of length 35 there are on the 2x2x2.

Using his generating function for our case, that is, to calculate how many move sequences are there on the 2x2x2 which are of length of 20 (since 20 is the upperbound/God's number for the 3x3x3 Rubik's Cube in htm = OBTM), we use the code:

gfh[n_, x_] := 3/(6 - 4 (3 x + 1)^(n - 1)) - 1/2

Series[gfh[2, x], {x, 0, 20}]

The coefficient of the x^20 term we get from Mathematica is 914,039,610,015,744 which could only possibly be a fraction of the 43,252,003,274,489,856,000 total 3x3x3 positions.

Lastly, how about some science fiction for comic relief. See this post of mine in another "god's number" thread on speedsolving.com in which I use the "pattern" of the number of digits of factorial to interestingly enough "approximate" what God's number could be close to on the nxnxn.

format: plain


text:
# Tag Info

6

One can prove that $p,q$ are Murray -von-Neumann equivalent if they fulfill $$\|aa^*-p\|<\frac 12,\quad \|a^*a-q\|<\frac 12.$$ The proof is standard (for example it is outlined in the comment of @ougao), I was just lucky to find $\|(1/2-p)^{-1}\|=2$. We first assume that the $C^*$-algebra $A$ is unital. First note that $(1-2p)^2=1$, hence ...

3

I had forgotten about this question until Jonas Meyer put a bounty on it. In hindsight, I think I now know how to solve parts of it... I'll write down what I've got and maybe someone can give a complete argument building on it. I'll address the case $1 \in A$ first since it is somewhat simpler. The argument does not seem to be overly difficult, but it is a ...

3

Inspired by George Lowther's solution, here is another more elementary example of a (nonunital) C*-algebra $A$ such that $A$ has no nonzero projections, but $M_2(A)$ does have nonzero projections. Let $D$ be the sub algebra of $M_2(\mathbb{C})$ consisting of scalar multiples of the identity. Let $C$ be the sub algebra of $M_2(\mathbb{C})$ consisting of ...

3

The answer to question 2 is negative. It is possible that there are projections in $M_\infty(A)$ which are not equivalent to any projection in $A$, even when $A$ is a $C^*$-algebra (so, representable) and spacious. To do this, I will construct a (non-unitial) $C^*$-algebra which has no non-zero projections, so is trivially spacious. However, $M_2(A)$ will ...

3

Yes, $$\mathbb C\,I=\{\lambda\,I:\ \lambda\in\mathbb C\}.$$ It is coherent with the notation $$AB=\{ab:\ a\in A,\ b\in B\},$$ and with $$A+B=\{a+b:\ a\in A,\ b\in B\},$$ etc.

3

Oh well, how silly of me not to have thought of the following argument sooner. In what follows, $(e_{i})_{i \in I}$ is a self-adjoint approximate identity of $A$ that is bounded in norm by $1$. It is $C^{*}$-folklore that such an approximate identity exists. Lemma. If $(x_{i})_{i \in I}$ is a convergent net in $A$ whose limit is $x$, ...

2

If $A$ is non-unital, then the spectrum of an element of $A$ is defined via the unitization $A^{+}$ of $A$. Hence, $\lambda \in \sigma(a)$ if and only if $(a,- \lambda) \in A^{+}$ is not invertible. It follows readily that $0 \in \sigma(a)$ for any $a \in A$. If $0 \notin \sigma(a)$, then $(a,0_{\Bbb{C}})$ would be invertible in $A^{+} ... 2 The exponential of an idempotent$R$is very easy to calculate: if$R^2=R$, then $$e^{i\pi R}=\sum_{k=0}^\infty\frac{i^k\,\pi^k\,R^k}{k!} =I+\sum_{k=1}^\infty\frac{i^k\,\pi^k\,R}{k!} =I-R+R\left(\sum_{k=0}^\infty\frac{i^k\pi^k}{k!}\right)\\ =I-R+e^{i\pi}R=I-2R.$$ Then $$U(e^{i\theta})=e^{i\pi E(e^{i\theta})}e^{i\pi F(e^{i\theta})} ... 2 In what follows, we assume that G is a locally compact Hausdorff group that does not have to be abelian. You can certainly define an involution ^{*} on {L^{1}}(G) by$$ \forall f \in {L^{1}}(G), ~ \forall x \in G: \quad {f^{*}}(x) \stackrel{\text{df}}{=} \overline{f(x^{-1})} \cdot \Delta(x^{-1}), $$where \Delta denotes the modular ... 2 Edit: Many thanks to Martin for bringing to my attention a flaw in my earlier argument. Here is an entirely new argument. In what follows, n \in \Bbb{N} and [n] \stackrel{\text{df}}{=} \Bbb{N}_{\leq n} . Let P_{1},\ldots,P_{n} be projections in B(\mathcal{H}) . Let \lambda_{1},\ldots,\lambda_{n} \in \Bbb{R}_{> 0} satisfy ... 2 I'm not sure if this approach works, but it looks too complicated. The usual way to show what the universal algebra is, is to show that you have the *-homomorphism onto any C^*-algebra with the desired generators and relations. In this case, if x_1,\ldots,x_n\in B(H) are as you postulate, you want to construct a *-homomorphism \rho:C(S^n)\to ... 2 For a\in A,$$\phi(a^*a) = \langle \pi(a^*a)h,h\rangle = ||\pi(a)h||^2\geq 0$$Which shows that \phi is a positive linear functional. By theorem 3.3.3 of Murphy's C*-algebras and operator theory, if \{u_i\} is approximate unit of C*-algebra A, then \|\phi\|=\lim \phi(u_i). Using this we have$$\|\phi\|=\lim \phi(u_i)=\langle \pi(u_i)h,h\rangle = ... 2 Here is my own attempt on the problem, which turns out to be essentially San’s argument above (I only realized this when writing my response). I would therefore like to focus on demystifying the continuous functional calculus that takes place in the argument and on making portions of it more transparent. All credit is due to San, of course, for posting the ... 2 Edit: previous answer was wrong. The assertion$\|KT_n\|\to0$does not hold in general. Let$H=\ell^2(\mathbb N)$, and $$T_n(a_1,a_2,\ldots,)=(a_n,a_{n+1},\ldots).$$ Then$T_n\to0$in the strong operator topology. Consider the rank-one operator$P$given by$P(a_1,a_2,\ldots)=(a_1,0,0,\ldots)$. Then $$PT_n(a_1,a_2,\ldots)=(a_n,0,0,\ldots).$$ If ... 1 Yes, your argument is the standard way of proving it. 1 As already mentioned, $$(\spadesuit) \qquad C(\Bbb{T}) \rtimes_{\alpha} \Bbb{Z}_{2} \cong \{ f \in C([0,1] \to {\text{M}_{2}}(\Bbb{C})) \mid \text{ f(0) and f(1) are diagonal} \}.$$ Hence, by the definition of a continuous field of$ C^{*} $-algebras,$ C(\Bbb{T}) \rtimes_{\alpha} \Bbb{Z}_{2} $is a continuous field of$ C^{*} $-algebras over the ... 1 The whole point of the multiplier algebra is that you should be able to multiply. So$\varphi(a)b$has to make sense. If you look at page 39 in Murphy's book, you see that the definition of$M(I)$includes a canonical identification of$I$as an ideal on$M(I)$. As Phoenix mentioned,$\varphi$extends the inclusion$I\to M(I)$. So ... 1 Because you are trying to prove (first) that$\phi$is unbounded on$A^+$. You do this because you want to use that your map is positive, so it makes sense to work on the positive part of$A$. The summands are positive. Because$\|\phi(p)\|$would be an upper bound for the natural numbers. 1 The Axiom Schema of Separation tells us that if$ A $is a set and$ \varphi $is a formula with a free variable, then the collection $$\{ x \mid x \in A ~ \text{and} ~ \varphi[x] \}$$ is a set. Now, fix both$ (G,A,\alpha) $and$ f \in {C_{c}}(G,A) $, and let$ \varphi[r] $denote the sentence There exists a covariant representation$ (\pi,U) $of$ ...

1

A $C^*$-algebra $A$ is isometric to an $L_1$-space (even as Banach space!) iff it is one dimensional. Assume $A$ is isometric to $L_1$ space and $\operatorname{dim}(A)>1$, then $A$ is weakly sequentially complete. By result of Sakai (proposition 2), this is possible only if $A$ is finite dimensional. By classification theorem for $C^*$ algebras we know ...

1

It is almost never true that $\overline{aAa}$ is generated by $a$. Note that $a$ is positive, so the algebra it generates is abelian. For the second part of the argument (which is irrelevant to the exercise, but let me address it for your benefit): your write "$\lim\sigma(p_n(a))$"; what do you mean by the limit of a sequence of sets? Also, when you ...

1

I don't think you can say anything. For example, let $A_1=K(H)\subset B(H)$ and $A_2\subset B(H)$ be an image of the Cuntz algebra $O_2$ via an irreducible representation; this representation is faithful, because $O_2$ is simple. The intersection $A_1\cap A_2$ is $0$, because $O_2$ has no compact operators. Now form $A=A_1\oplus A_2$, and let $\pi_j:A\to ... 1 If$A$is non-unital, then by definition $$\sigma_A(a) = \sigma_{A_1}(a)$$ where$A_1$is the unitization of$A$, and necessarily one has that$0\in \sigma_A(a)$. One can then define $$I = \{f \in C(\sigma_A(a)) : f(0) = 0\}$$ and obtain a homomorphism$\varphi : I \to A$as you have mentioned. However,$I \neq C_0(\sigma_A(a))$in the sense of ... 1 By continuity of$p, q :X \rightarrow M_n \mathbb(C)$, and (ii), and the total disconnectedess of$X$, find a partition of X into clopen sets$X_1,\cdots, X_k$and complex matrix$v_1,\cdots,v_k$such that$\|v_i^*v_i - p(x)\|<1$and$\|v_iv_i^* - q(x)\|<1$for all$x \in X_i$. Now, define the map$f: X \rightarrow M_n (C)$,$f(x) = v_i$,$x \in ...

1

Not exactly. You only need to omit the term with $k=l=0$. As for the unitization yes, if you algebra $B$ is embedded in a unital algebra $A$, then the unitization of $B$ is isomorphic to the subalgebra of $A$ generated by $B$ and $e$. $\sigma_V(v)$ is compact regardless; it is just defined as a the spectrum of $v$ in $V_1$, and this is a compact subset of ...

1

In a $C^\ast$ algebra, this is easy. You have $\Vert a \Vert = \Vert a^\ast \Vert$ and (by definition of a $C^\ast$ algebra) you have $$\Vert a^\ast \Vert^2 = \Vert (a^\ast)^\ast a^\ast \Vert = \Vert a \cdot a^\ast\Vert,$$ so that taking $b = \frac{a^\ast}{\Vert a\Vert}$ yields your claim, since the estimate \$\Vert ab \Vert \leq \Vert a \Vert \Vert b ...

Only top voted, non community-wiki answers of a minimum length are eligible


text:
#### Volume 19, issue 1 (2019)

 Recent Issues
 The Journal About the Journal Editorial Board Editorial Interests Subscriptions Submission Guidelines Submission Page Policies for Authors Ethics Statement ISSN (electronic): 1472-2739 ISSN (print): 1472-2747 Author Index To Appear Other MSP Journals
The verbal width of acylindrically hyperbolic groups

### Mladen Bestvina, Kenneth Bromberg and Koji Fujiwara

Algebraic & Geometric Topology 19 (2019) 477–489
##### Abstract

We show that the verbal width is infinite for acylindrically hyperbolic groups, which include hyperbolic groups, mapping class groups and $Out\left({F}_{n}\right)$.

##### Keywords
verbal subgroups, acylindrically hyperbolic groups, quasimorphisms
##### Mathematical Subject Classification 2010
Primary: 20F65, 20F67


text:
# Determining if Points are Inside a Circle

Write a class named InCircleDeterminer whose main method prompts the user for two ordered pairs and a radius length, and determines if the point indicated by the first ordered pair is in the circle whose center is indicated by the second ordered pair and which has the aforementioned radius. The method then displays an appropriate message to the user. All values displayed by the program should be formatted to have 2 decimal places.

Sample run 1:

This program determines if a given point is in a circle with a given center and radius.
---------------------------------------------------------------------------------------
Enter the coordinates of the given point (separated by a space): 3 4
Enter the coordinates of the center of the circle (separated by a space): 0 0
Enter the length of the radius: 4
The given point is not in the circle you described

Sample run 2:

This program determines if a given point is in a circle with a given center and radius.
---------------------------------------------------------------------------------------
Enter the coordinates of the given point (separated by a space): 3 4
Enter the coordinates of the center of the circle (separated by a space): 2 2
Enter the length of the radius: 4
The given point is in the circle you described

Tags: java.util.Scanner, the conditional operator "?"


text:
What is (-5pi)/12  radians in degrees?

Jan 27, 2016

Convert by multiplying the expression by $\frac{180}{\pi}$

Explanation:

$\frac{5 \pi}{12} \times \left(\frac{180}{\pi}\right)$

We can simplify the fractions before multiplying: the $\pi$'s eliminate themselves and the 180 is divided by 12, which gives 15.

= 15 $\times$ 5

= 75 degrees

The rule is the opposite when converting from degrees to radians: you multiply by $\frac{\pi}{180}$.

Practice exercises:

1. Convert to degrees. Round to 2 decimals if necessary.

a) $\frac{5 \pi}{4}$ radians

b) $\frac{2 \pi}{7}$ radians


text:
# Physics 221 Calc-based question for homework

Tags:
1. Jan 20, 2017

### AidenPhysica

1. The problem statement, all variables and given/known data
If vector d1--> is equal to 2i^-4j^+9k^ and vector d2-> is equal to 8i^-10j^+9k^, what is (d1-->+d2-->) * (d1--> X 4d2->)?

2. Relevant equations

3. The attempt at a solution
So I added up first two vectors and then multiplied it by the cross product but I get a vector and when I find its length its like 1931. I just want to know if this is even close.

2. Jan 20, 2017

### Staff: Mentor

Hi AidenPhysica, Welcome to Physics Forums.

Your result does not look correct to me. Can you show the details of your calculations?

3. Jan 20, 2017

### Staff: Mentor

$$(\vec{d_1} + \vec{d_2}) \cdot (\vec{d_1} \times 4 \vec{d_2})$$
?

If that is correct, then your result is wrong. What to you get when you take the cross product of two vectors?

4. Jan 20, 2017

### AidenPhysica

Its right what you put except there has to be a 4 right in front of d2 so its multiplied by four.

5. Jan 20, 2017

### Staff: Mentor

I've corrected it. So, what do you get when you take the cross product of two vectors?

6. Jan 20, 2017

### AidenPhysica

Ok, so this is what I did. I first added up the two vectors to get 10i+-14j+18k. Then you do the cross product, so I did that operation of the cross product, which is basically how much two vectors are perpendicular to each other? So here is the matrix i j k on top second row is 2, -4, 9. Third row is 32i-40j+36k. The cross product of this matrix is

7. Jan 20, 2017

### AidenPhysica

216i +216j+48k

8. Jan 20, 2017

### Staff: Mentor

I'll give you a hint: the actual values of the vectors are not important.

What is the orientation of that vector with respect to the original vectors?

9. Jan 20, 2017

### AidenPhysica

Then what I did was I multiplied each respective component of the first answer times the second to get 3815 after doing pythagrean theorem is that better?

10. Jan 20, 2017

### AidenPhysica

OK, so what do you mean by orientation?

11. Jan 20, 2017

### Staff: Mentor

Stop a minute. I want you to think about the problem first. You can calculate numerical values later.

The direction in which it points. When you take the cross product of two vectors, the resulting vector points in a very specific direction with respect to the two other vectors.

12. Jan 20, 2017

### AidenPhysica

so isn't the cross product equal to magnitude of a times magnitude of b multiplied by sin of theta?

13. Jan 20, 2017

### AidenPhysica

Isn't cross product equal to magnitude of a times magnitude of b times sin of theta?

14. Jan 20, 2017

### AidenPhysica

so isn't it just: ok so we have 10.05 times 26.83 times sin of theta=309.22. So then theta=309.22/269.6*(arcsin)

15. Jan 20, 2017

### AidenPhysica

I don't know it doesn't work.

16. Jan 20, 2017

### AidenPhysica

I try plugging it into a times b sin theta = magnitude of cross product but it just doesn't work.

17. Jan 20, 2017

### Staff: Mentor

18. Jan 20, 2017

### AidenPhysica

so how do i find orientation though?

19. Jan 20, 2017

### AidenPhysica

Is it in degrees? I am just confused I see the picture, its like perpendicular.

20. Jan 20, 2017

### Staff: Mentor

Yes, the resulting vector is perpendicular to the plane of the two initial vectors.


text:
# Kerodon

$\Newextarrow{\xRightarrow}{5,5}{0x21D2}$ $\newcommand\empty{}$

Remark 5.1.1.11. Suppose we are given a pullback diagram of simplicial sets

$\xymatrix@R =50pt@C=50pt{ X' \ar [d]^-{q'} \ar [r]^-{f} & X \ar [d]^-{q} \\ S' \ar [r] & S. }$

Let $e'$ be an edge of the simplicial set $X'$, having image $e = f(e')$ in $X$. If $e$ is $q$-cartesian, then $e'$ is $q'$-cartesian. Similarly, if $e$ is $q$-cocartesian, then $e'$ is $q'$-cocartesian.