VkShaderCreateInfoEXT(3)

# VkShaderCreateInfoEXT(3) Manual Page

## Name

VkShaderCreateInfoEXT - Structure specifying parameters of a newly created shader

Loading… please wait.

## C Specification

The `VkShaderCreateInfoEXT` structure is defined as:

    // Provided by VK_EXT_shader_object
    typedef struct VkShaderCreateInfoEXT {
        VkStructureType                 sType;
        const void*                     pNext;
        VkShaderCreateFlagsEXT          flags;
        VkShaderStageFlagBits           stage;
        VkShaderStageFlags              nextStage;
        VkShaderCodeTypeEXT             codeType;
        size_t                          codeSize;
        const void*                     pCode;
        const char*                     pName;
        uint32_t                        setLayoutCount;
        const VkDescriptorSetLayout*    pSetLayouts;
        uint32_t                        pushConstantRangeCount;
        const VkPushConstantRange*      pPushConstantRanges;
        const VkSpecializationInfo*     pSpecializationInfo;
    } VkShaderCreateInfoEXT;

## Members

- `sType` is the type of this structure.

- `pNext` is `NULL` or a pointer to a structure extending this structure.

- `flags` is a bitmask of VkShaderCreateFlagsEXT describing additional parameters of the shader.

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

- `nextStage` is a bitmask of VkShaderStageFlags specifying zero or more logically later stages which may be used as a logically next bound stage when drawing with the shader bound.

- `codeType` is a VkShaderCodeTypeEXT value specifying the type of the shader code pointed to be `pCode`.

- `codeSize` is the size in bytes of the shader code pointed to be `pCode`.

- `pCode` is a pointer to the shader code to use to create the shader.

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

- `setLayoutCount` is the number of descriptor set layouts pointed to by `pSetLayouts`.

- `pSetLayouts` is a pointer to an array of VkDescriptorSetLayout objects used by the shader stage.

- `pushConstantRangeCount` is the number of push constant ranges pointed to by `pPushConstantRanges`.

- `pPushConstantRanges` is a pointer to an array of VkPushConstantRange structures used by the shader stage.

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

## Description

Valid Usage

- VUID-VkShaderCreateInfoEXT-flags-08412
  If `stage` is not `VK_SHADER_STAGE_TASK_BIT_EXT`, `VK_SHADER_STAGE_MESH_BIT_EXT`, `VK_SHADER_STAGE_VERTEX_BIT`, `VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT`, `VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT`, `VK_SHADER_STAGE_GEOMETRY_BIT`, or `VK_SHADER_STAGE_FRAGMENT_BIT`, `flags` must not include `VK_SHADER_CREATE_LINK_STAGE_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-flags-08486
  If `stage` is not `VK_SHADER_STAGE_FRAGMENT_BIT`, `flags` must not include `VK_SHADER_CREATE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-flags-08487
  If the `attachmentFragmentShadingRate` feature is not enabled, `flags` must not include `VK_SHADER_CREATE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-flags-08488
  If `stage` is not `VK_SHADER_STAGE_FRAGMENT_BIT`, `flags` must not include VK_SHADER_CREATE_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT

- VUID-VkShaderCreateInfoEXT-flags-08489
  If the `fragmentDensityMap` feature is not enabled, `flags` must not include `VK_SHADER_CREATE_FRAGMENT_DENSITY_MAP_ATTACHMENT_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-flags-08413
  If `stage` is not `VK_SHADER_STAGE_COMPUTE_BIT`, `flags` must not include `VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT` or `VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-flags-08485
  If `stage` is not `VK_SHADER_STAGE_COMPUTE_BIT`, `flags` must not include `VK_SHADER_CREATE_DISPATCH_BASE_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-flags-08414
  If `stage` is not `VK_SHADER_STAGE_MESH_BIT_EXT`, `flags` must not include `VK_SHADER_CREATE_NO_TASK_SHADER_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-flags-08416
  If `flags` includes both `VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT` and `VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT`, the local workgroup size in the X dimension of the shader must be a multiple of `maxSubgroupSize`

- VUID-VkShaderCreateInfoEXT-flags-08417
  If `flags` includes `VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT` but not `VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT` and no VkShaderRequiredSubgroupSizeCreateInfoEXT structure is included in the `pNext` chain, the local workgroup size in the X dimension of the shader must be a multiple of `subgroupSize`

- VUID-VkShaderCreateInfoEXT-stage-08418
  `stage` must not be `VK_SHADER_STAGE_ALL_GRAPHICS` or `VK_SHADER_STAGE_ALL`

- VUID-VkShaderCreateInfoEXT-stage-08419
  If the `tessellationShader` feature is not enabled, `stage` must not be `VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT` or `VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT`

- VUID-VkShaderCreateInfoEXT-stage-08420
  If the `geometryShader` feature is not enabled, `stage` must not be `VK_SHADER_STAGE_GEOMETRY_BIT`

- VUID-VkShaderCreateInfoEXT-stage-08421
  If the `taskShader` feature is not enabled, `stage` must not be `VK_SHADER_STAGE_TASK_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-stage-08422
  If the `meshShader` feature is not enabled, `stage` must not be `VK_SHADER_STAGE_MESH_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-stage-08425
  `stage` must not be `VK_SHADER_STAGE_SUBPASS_SHADING_BIT_HUAWEI`

- VUID-VkShaderCreateInfoEXT-stage-08426
  `stage` must not be `VK_SHADER_STAGE_CLUSTER_CULLING_BIT_HUAWEI`

- VUID-VkShaderCreateInfoEXT-nextStage-08427
  If `stage` is `VK_SHADER_STAGE_VERTEX_BIT`, `nextStage` must not include any bits other than `VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT`, `VK_SHADER_STAGE_GEOMETRY_BIT`, and `VK_SHADER_STAGE_FRAGMENT_BIT`

- VUID-VkShaderCreateInfoEXT-nextStage-08428
  If `stage` is `VK_SHADER_STAGE_VERTEX_BIT` and the `tessellationShader` feature is not enabled, `nextStage` must not include `VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT`

- VUID-VkShaderCreateInfoEXT-nextStage-08429
  If `stage` is `VK_SHADER_STAGE_VERTEX_BIT` and the `geometryShader` feature is not enabled, `nextStage` must not include `VK_SHADER_STAGE_GEOMETRY_BIT`

- VUID-VkShaderCreateInfoEXT-nextStage-08430
  If `stage` is `VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT`, `nextStage` must not include any bits other than `VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT`

- VUID-VkShaderCreateInfoEXT-nextStage-08431
  If `stage` is `VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT`, `nextStage` must not include any bits other than `VK_SHADER_STAGE_GEOMETRY_BIT` and `VK_SHADER_STAGE_FRAGMENT_BIT`

- VUID-VkShaderCreateInfoEXT-nextStage-08432
  If `stage` is `VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT` and the `geometryShader` feature is not enabled, `nextStage` must not include `VK_SHADER_STAGE_GEOMETRY_BIT`

- VUID-VkShaderCreateInfoEXT-nextStage-08433
  If `stage` is `VK_SHADER_STAGE_GEOMETRY_BIT`, `nextStage` must not include any bits other than `VK_SHADER_STAGE_FRAGMENT_BIT`

- VUID-VkShaderCreateInfoEXT-nextStage-08434
  If `stage` is `VK_SHADER_STAGE_FRAGMENT_BIT` or `VK_SHADER_STAGE_COMPUTE_BIT`, `nextStage` must be 0

- VUID-VkShaderCreateInfoEXT-nextStage-08435
  If `stage` is `VK_SHADER_STAGE_TASK_BIT_EXT`, `nextStage` must not include any bits other than `VK_SHADER_STAGE_MESH_BIT_EXT`

- VUID-VkShaderCreateInfoEXT-nextStage-08436
  If `stage` is `VK_SHADER_STAGE_MESH_BIT_EXT`, `nextStage` must not include any bits other than `VK_SHADER_STAGE_FRAGMENT_BIT`

- VUID-VkShaderCreateInfoEXT-codeSize-08439
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, `codeSize` must be a multiple of 4

- VUID-VkShaderCreateInfoEXT-pName-08440
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, `pName` must be the name of an `OpEntryPoint` in `pCode` with an execution model that matches `stage`

- VUID-VkShaderCreateInfoEXT-pCode-08441
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, `pCode` must point to valid SPIR-V code, formatted and packed as described by the Khronos SPIR-V Specification

- VUID-VkShaderCreateInfoEXT-pCode-08442
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, `pCode` must adhere to the validation rules described by the Validation Rules within a Module section of the SPIR-V Environment appendix

- VUID-VkShaderCreateInfoEXT-pCode-08443
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, `pCode` must declare the `Shader` capability for SPIR-V code

- VUID-VkShaderCreateInfoEXT-pCode-08444
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, `pCode` must not declare any capability that is not supported by the API, as described by the Capabilities section of the SPIR-V Environment appendix

- VUID-VkShaderCreateInfoEXT-pCode-08445
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and `pCode` declares any of the capabilities listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied

- VUID-VkShaderCreateInfoEXT-pCode-08446
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, `pCode` must not declare any SPIR-V extension that is not supported by the API, as described by the Extension section of the SPIR-V Environment appendix

- VUID-VkShaderCreateInfoEXT-pCode-08447
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and `pCode` declares any of the SPIR-V extensions listed in the SPIR-V Environment appendix, one of the corresponding requirements must be satisfied

- VUID-VkShaderCreateInfoEXT-pCode-08448
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and 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`

- VUID-VkShaderCreateInfoEXT-pCode-08449
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and 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`

- VUID-VkShaderCreateInfoEXT-pCode-08450
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and 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`

- VUID-VkShaderCreateInfoEXT-pCode-08451
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and 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`

- VUID-VkShaderCreateInfoEXT-pCode-08452
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and `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`

- VUID-VkShaderCreateInfoEXT-pCode-08453
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and `stage` is `VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT` or `VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT`, and the identified entry point has an `OpExecutionMode` instruction specifying a patch size with `OutputVertices`, the patch size must be greater than `0` and less than or equal to `VkPhysicalDeviceLimits`::`maxTessellationPatchSize`

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

- VUID-VkShaderCreateInfoEXT-pCode-08455
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and `stage` is `VK_SHADER_STAGE_GEOMETRY_BIT`, the identified entry point must have an `OpExecutionMode` instruction specifying an invocation count that is greater than `0` and less than or equal to `VkPhysicalDeviceLimits`::`maxGeometryShaderInvocations`

- VUID-VkShaderCreateInfoEXT-pCode-08456
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and `stage` is a pre-rasterization shader 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

- VUID-VkShaderCreateInfoEXT-pCode-08457
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and `stage` is a pre-rasterization shader 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

- VUID-VkShaderCreateInfoEXT-pCode-08458
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and `stage` is `VK_SHADER_STAGE_FRAGMENT_BIT`, the identified entry point must not include any output variables in its interface decorated with `CullDistance`

- VUID-VkShaderCreateInfoEXT-pCode-08459
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, and `stage` is `VK_SHADER_STAGE_FRAGMENT_BIT`, and the identified entry point writes to `FragDepth` in any execution path, all execution paths that are not exclusive to helper invocations must either discard the fragment, or write or initialize the value of `FragDepth`

- VUID-VkShaderCreateInfoEXT-pCode-08460
  If `codeType` is `VK_SHADER_CODE_TYPE_SPIRV_EXT`, the shader code in `pCode` must be valid as described by the Khronos SPIR-V Specification after applying the specializations provided in `pSpecializationInfo`, if any, and then converting all specialization constants into fixed constants

Valid Usage (Implicit)

- VUID-VkShaderCreateInfoEXT-sType-sType
  `sType` must be `VK_STRUCTURE_TYPE_SHADER_CREATE_INFO_EXT`

- VUID-VkShaderCreateInfoEXT-pNext-pNext
  `pNext` must be `NULL` or a pointer to a valid instance of VkPipelineShaderStageRequiredSubgroupSizeCreateInfo

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

- VUID-VkShaderCreateInfoEXT-flags-parameter
  `flags` must be a valid combination of VkShaderCreateFlagBitsEXT values

- VUID-VkShaderCreateInfoEXT-stage-parameter
  `stage` must be a valid VkShaderStageFlagBits value

- VUID-VkShaderCreateInfoEXT-nextStage-parameter
  `nextStage` must be a valid combination of VkShaderStageFlagBits values

- VUID-VkShaderCreateInfoEXT-codeType-parameter
  `codeType` must be a valid VkShaderCodeTypeEXT value

- VUID-VkShaderCreateInfoEXT-pCode-parameter
  `pCode` must be a valid pointer to an array of `codeSize` bytes

- VUID-VkShaderCreateInfoEXT-pName-parameter
  If `pName` is not `NULL`, `pName` must be a null-terminated UTF-8 string

- VUID-VkShaderCreateInfoEXT-pSetLayouts-parameter
  If `setLayoutCount` is not `0`, and `pSetLayouts` is not `NULL`, `pSetLayouts` must be a valid pointer to an array of `setLayoutCount` valid VkDescriptorSetLayout handles

- VUID-VkShaderCreateInfoEXT-pPushConstantRanges-parameter
  If `pushConstantRangeCount` is not `0`, and `pPushConstantRanges` is not `NULL`, `pPushConstantRanges` must be a valid pointer to an array of `pushConstantRangeCount` valid VkPushConstantRange structures

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

- VUID-VkShaderCreateInfoEXT-codeSize-arraylength
  `codeSize` must be greater than `0`

## See Also

VK_EXT_shader_object, VkDescriptorSetLayout, VkPushConstantRange, VkShaderCodeTypeEXT, VkShaderCreateFlagsEXT, VkShaderStageFlagBits, VkShaderStageFlags, VkSpecializationInfo, VkStructureType, vkCreateShadersEXT

## 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 2014-2023 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0