VkPipelineShaderStageCreateInfo(3)

# VkPipelineShaderStageCreateInfo(3) Manual Page

## Name

VkPipelineShaderStageCreateInfo - Structure specifying parameters of a newly created pipeline shader stage

## C Specification

The `VkPipelineShaderStageCreateInfo` structure is defined as:

    typedef struct VkPipelineShaderStageCreateInfo {
        VkStructureType                     sType;
        const void*                         pNext;
        VkPipelineShaderStageCreateFlags    flags;
        VkShaderStageFlagBits               stage;
        VkShaderModule                      module;
        const char*                         pName;
        const VkSpecializationInfo*         pSpecializationInfo;
    } VkPipelineShaderStageCreateInfo;

## Members

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to an extension-specific structure.

- `flags` is a bitmask of VkPipelineShaderStageCreateFlagBits specifying how the pipeline shader stage will be generated.

- `stage` is a VkShaderStageFlagBits value specifying a single pipeline stage.

- `module` is a VkShaderModule object containing the shader for this stage.

- `pName` is a pointer to a null-terminated UTF-8 string specifying the entry point name of the shader for this stage.

- `pSpecializationInfo` is a pointer to a VkSpecializationInfo structure, as described in Specialization Constants, or `NULL`.

## Description

Valid Usage

- If the geometry shaders feature is not enabled, `stage` must not be `VK_SHADER_STAGE_GEOMETRY_BIT`

- If the tessellation shaders feature is not enabled, `stage` must not be `VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT` or `VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT`

- If the mesh shader feature is not enabled, `stage` must not be `VK_SHADER_STAGE_MESH_BIT_NV`

- If the task shader feature is not enabled, `stage` must not be `VK_SHADER_STAGE_TASK_BIT_NV`

- `stage` must not be `VK_SHADER_STAGE_ALL_GRAPHICS`, or `VK_SHADER_STAGE_ALL`

- `pName` must be the name of an `OpEntryPoint` in `module` with an execution model that matches `stage`

- If the identified entry point includes any variable in its interface that is declared with the `ClipDistance` `BuiltIn` decoration, that variable must not have an array size greater than `VkPhysicalDeviceLimits`::`maxClipDistances`

- If the identified entry point includes any variable in its interface that is declared with the `CullDistance` `BuiltIn` decoration, that variable must not have an array size greater than `VkPhysicalDeviceLimits`::`maxCullDistances`

- If the identified entry point includes any variables in its interface that are declared with the `ClipDistance` or `CullDistance` `BuiltIn` decoration, those variables must not have array sizes which sum to more than `VkPhysicalDeviceLimits`::`maxCombinedClipAndCullDistances`

- If the identified entry point includes any variable in its interface that is declared with the `SampleMask` `BuiltIn` decoration, that variable must not have an array size greater than `VkPhysicalDeviceLimits`::`maxSampleMaskWords`

- If `stage` is `VK_SHADER_STAGE_VERTEX_BIT`, the identified entry point must not include any input variable in its interface that is decorated with `CullDistance`

- If `stage` is `VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT` or `VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT`, and the identified entry point has an `OpExecutionMode` instruction that specifies a patch size with `OutputVertices`, the patch size must be greater than `0` and less than or equal to `VkPhysicalDeviceLimits`::`maxTessellationPatchSize`

- If `stage` is `VK_SHADER_STAGE_GEOMETRY_BIT`, the identified entry point must have an `OpExecutionMode` instruction that specifies a maximum output vertex count that is greater than `0` and less than or equal to `VkPhysicalDeviceLimits`::`maxGeometryOutputVertices`

- If `stage` is `VK_SHADER_STAGE_GEOMETRY_BIT`, the identified entry point must have an `OpExecutionMode` instruction that specifies an invocation count that is greater than `0` and less than or equal to `VkPhysicalDeviceLimits`::`maxGeometryShaderInvocations`

- If `stage` is a vertex processing stage, and the identified entry point writes to `Layer` for any primitive, it must write the same value to `Layer` for all vertices of a given primitive

- If `stage` is a vertex processing stage, and the identified entry point writes to `ViewportIndex` for any primitive, it must write the same value to `ViewportIndex` for all vertices of a given primitive

- If `stage` is `VK_SHADER_STAGE_FRAGMENT_BIT`, the identified entry point must not include any output variables in its interface decorated with `CullDistance`

- If `stage` is `VK_SHADER_STAGE_FRAGMENT_BIT`, and the identified entry point writes to `FragDepth` in any execution path, it must write to `FragDepth` in all execution paths

- If `stage` is `VK_SHADER_STAGE_FRAGMENT_BIT`, and the identified entry point writes to `FragStencilRefEXT` in any execution path, it must write to `FragStencilRefEXT` in all execution paths

- If `stage` is `VK_SHADER_STAGE_MESH_BIT_NV`, the identified entry point must have an `OpExecutionMode` instruction that specifies a maximum output vertex count, `OutputVertices`, that is greater than `0` and less than or equal to `VkPhysicalDeviceMeshShaderPropertiesNV`::`maxMeshOutputVertices`.

- If `stage` is `VK_SHADER_STAGE_MESH_BIT_NV`, the identified entry point must have an `OpExecutionMode` instruction that specifies a maximum output primitive count, `OutputPrimitivesNV`, that is greater than `0` and less than or equal to `VkPhysicalDeviceMeshShaderPropertiesNV`::`maxMeshOutputPrimitives`.

- If `flags` has the `VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT` flag set, the `subgroupSizeControl` feature must be enabled.

- If `flags` has the `VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT` flag set, the `computeFullSubgroups` feature must be enabled.

- If a VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT structure is included in the `pNext` chain, `flags` must not have the `VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT` flag set.

- If a VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT structure is included in the `pNext` chain, the `subgroupSizeControl` feature must be enabled, and `stage` must be a valid bit specified in `requiredSubgroupSizeStages`.

- If a VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT structure is included in the `pNext` chain and `stage` is `VK_SHADER_STAGE_COMPUTE_BIT`, the local workgroup size of the shader must be less than or equal to the product of VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT::`requiredSubgroupSize` and `maxComputeWorkgroupSubgroups`.

- If a VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT structure is included in the `pNext` chain, and `flags` has the `VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT` flag set, the local workgroup size in the X dimension of the pipeline must be a multiple of VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT::`requiredSubgroupSize`.

- If `flags` has both the `VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT` and `VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT` flags set, the local workgroup size in the X dimension of the pipeline must be a multiple of `maxSubgroupSize`.

- If `flags` has the `VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT` flag set and `flags` does not have the `VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT` flag set and no VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT structure is included in the `pNext` chain, the local workgroup size in the X dimension of the pipeline must be a multiple of `subgroupSize`.

Valid Usage (Implicit)

- `sType` must be `VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO`

- `pNext` must be `NULL` or a pointer to a valid instance of VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT

- The `sType` value of each struct in the `pNext` chain must be unique

- `flags` must be a valid combination of VkPipelineShaderStageCreateFlagBits values

- `stage` must be a valid VkShaderStageFlagBits value

- `module` must be a valid VkShaderModule handle

- `pName` must be a null-terminated UTF-8 string

- If `pSpecializationInfo` is not `NULL`, `pSpecializationInfo` must be a valid pointer to a valid VkSpecializationInfo structure

## See Also

VkComputePipelineCreateInfo, VkGraphicsPipelineCreateInfo, VkGraphicsShaderGroupCreateInfoNV, VkPipelineShaderStageCreateFlags, VkRayTracingPipelineCreateInfoKHR, VkRayTracingPipelineCreateInfoNV, VkShaderModule, VkShaderStageFlagBits, VkSpecializationInfo, VkStructureType

## Document Notes

For more information, see the Vulkan Specification

This page is extracted from the Vulkan Specification. Fixes and changes should be made to the Specification, not directly.

## Copyright

Copyright (c) 2014-2020 Khronos Group. This work is licensed under a Creative Commons Attribution 4.0 International License.