VkShaderCreateInfoEXT(3)

# VkShaderCreateInfoEXT(3) Manual Page

## Name

VkShaderCreateInfoEXT - Structure specifying parameters of a newly created shader

## 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 a VkStructureType value identifying this structure.

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

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

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

- `nextStage` is a bitmask of VkShaderStageFlagBits specifying which stages can be used as a logically next bound stage when drawing with the shader bound. A value of zero indicates this shader stage must be the last one.

- `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. The implementation must not access these objects outside of the duration of the command this structure is passed to.

- `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

When determining pipeline layout compatibility, compatibility is determined as if a the shader was created with a pipeline layout object that was created with identical values of `setLayoutCount`, `pSetLayouts`, `pushConstantRangeCount`, and `pPushConstantRanges`, and with VkPipelineLayoutCreateInfo::`flags` set to 0. If `flags` includes VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT, the shader is not considered created with a pipeline layout.

When specifying descriptor heap mappings, only mappings corresponding to bindings that are actually present in the SPIR-V shader affect compilation. Mappings are ignored when `codeType` is VK_SHADER_CODE_TYPE_BINARY_EXT. The resulting compiled binary from two different SPIR-V shaders which would have identical bit patterns must remain identical even if the mapping entries vary in any of the following ways:

- Different numbers of unused mapping structures

- Different binding counts for unused bindings

- Unused parameters in mapping structures (e.g. sampler offsets)

- Ignored parameters in mapping structures

- Different order of mapping structures, used or unused

Note | Calculating the same offset in a mapping via different parameter values is not guaranteed to provide identical results.

Valid Usage

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

- VUID-VkShaderCreateInfoEXT-pCode-08736
  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-08737
  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-08738
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, `pCode` must declare the `Shader` capability for SPIR-V code

- VUID-VkShaderCreateInfoEXT-pCode-08739
  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-08740
  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-08741
  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-08742
  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-descriptorHeap-11314
  If the `descriptorHeap` feature is not enabled, VkShaderDescriptorSetAndBindingMappingInfoEXT::`mappingCount` must be 0

- VUID-VkShaderCreateInfoEXT-pNext-11315
  If the `pNext` chain specifies a descriptor mapping using VK_DESCRIPTOR_MAPPING_SOURCE_PUSH_DATA_EXT, VK_DESCRIPTOR_MAPPING_SOURCE_SHADER_RECORD_DATA_EXT, or VK_DESCRIPTOR_MAPPING_SOURCE_RESOURCE_HEAP_DATA_EXT, the mapped resource in the shader must be a variable with a structure type decorated with `Block` in the `Uniform` `Storage` `Class`

- VUID-VkShaderCreateInfoEXT-pNext-11316
  If the `pNext` chain specifies a descriptor mapping using VK_DESCRIPTOR_MAPPING_SOURCE_PUSH_DATA_EXT, the mapped structure must not be larger than `maxPushDataSize` minus the `pushDataOffset` used in the mapping

- VUID-VkShaderCreateInfoEXT-pNext-12454
  If the `pNext` chain specifies a descriptor mapping using VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_SHADER_RECORD_INDEX_EXT, VK_DESCRIPTOR_MAPPING_SOURCE_SHADER_RECORD_DATA_EXT, or VK_DESCRIPTOR_MAPPING_SOURCE_SHADER_RECORD_ADDRESS_EXT, and there is a variable in the shader that matches the mapping, the `stage` must be a ray tracing stage

- VUID-VkShaderCreateInfoEXT-pNext-11317
  If the `pNext` chain specifies a descriptor mapping using VK_DESCRIPTOR_MAPPING_SOURCE_SHADER_RECORD_DATA_EXT, the sum of mapped structure size and `shaderRecordDataOffset` used in the mapping must not be larger than `maxShaderGroupStride`

- VUID-VkShaderCreateInfoEXT-pNext-11318
  If the `pNext` chain specifies a descriptor mapping using VK_DESCRIPTOR_MAPPING_SOURCE_SHADER_RECORD_ADDRESS_EXT, VK_DESCRIPTOR_MAPPING_SOURCE_PUSH_ADDRESS_EXT, or VK_DESCRIPTOR_MAPPING_SOURCE_INDIRECT_ADDRESS_EXT the mapped resource in the shader must be one of:

  - A variable with a structure type decorated with `Block` in the `Uniform` `Storage` `Class`

  - A variable with a structure type decorated with `BufferBlock` in the `Uniform` `Storage` `Class`

  - A variable with a structure type decorated with `Block` in the `StorageBuffer` `Storage` `Class`

  - A `OpTypeAccelerationStructureKHR` variable

  - A `OpTypeAccelerationStructureNV` variable

- VUID-VkShaderCreateInfoEXT-pNext-11378
  If the `pNext` chain specifies a descriptor mapping using VK_DESCRIPTOR_MAPPING_SOURCE_PUSH_ADDRESS_EXT, VK_DESCRIPTOR_MAPPING_SOURCE_SHADER_RECORD_ADDRESS_EXT, or VK_DESCRIPTOR_MAPPING_SOURCE_INDIRECT_ADDRESS_EXT, the `OpArrayLength` or `OpUntypedArrayLengthKHR` instruction must not be used on that resource

- VUID-VkShaderCreateInfoEXT-pNext-11399
  If the `pNext` chain specifies a descriptor mapping using VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_CONSTANT_OFFSET_EXT, VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_PUSH_INDEX_EXT, VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_SHADER_RECORD_INDEX_EXT, VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_INDIRECT_INDEX_EXT, or VK_DESCRIPTOR_MAPPING_SOURCE_HEAP_WITH_INDIRECT_INDEX_ARRAY_EXT, and the mapped resource declaration is an array, the `pEmbeddedSampler` member of the corresponding mapping structure must be `NULL`

- 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-micromap-11623
  If `flags` includes VK_SHADER_CREATE_OPACITY_MICROMAP_DISALLOW_MIXED_SPECIAL_INDEX_BIT_EXT, the `VkPhysicalDeviceOpacityMicromapFeaturesKHR`::`micromap` feature must be enabled

- VUID-VkShaderCreateInfoEXT-flags-09404
  If `flags` includes VK_SHADER_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT, the `subgroupSizeControl` feature must be enabled

- VUID-VkShaderCreateInfoEXT-flags-09405
  If `flags` includes VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT, the `computeFullSubgroups` feature must be enabled

- VUID-VkShaderCreateInfoEXT-flags-11005
  If `flags` includes VK_SHADER_CREATE_INDIRECT_BINDABLE_BIT_EXT, then the `VkPhysicalDeviceDeviceGeneratedCommandsFeaturesEXT`::`deviceGeneratedCommands` feature must be enabled

- VUID-VkShaderCreateInfoEXT-flags-11006
  If `flags` includes VK_SHADER_CREATE_INDIRECT_BINDABLE_BIT_EXT, then the identified entry point must not specify `Xfb` execution mode

- VUID-VkShaderCreateInfoEXT-flags-08992
  If `flags` includes VK_SHADER_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT, `stage` must be one of VK_SHADER_STAGE_MESH_BIT_EXT, VK_SHADER_STAGE_TASK_BIT_EXT, or VK_SHADER_STAGE_COMPUTE_BIT

- 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 the `tessellationShader` feature is not enabled, `nextStage` must not include VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT or VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT

- VUID-VkShaderCreateInfoEXT-nextStage-08429
  If 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-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-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-08492
  If `codeType` is VK_SHADER_CODE_TYPE_BINARY_EXT, `pCode` must be aligned to `16` bytes

- VUID-VkShaderCreateInfoEXT-pCode-08493
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, `pCode` must be aligned to `4` bytes

- 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 variables in its interface that are declared with the `ClipDistance` `BuiltIn` decoration and variables in its interface that are declared with the `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-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-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

- VUID-VkShaderCreateInfoEXT-codeType-08872
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, and `stage` is VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT, `pCode` must contain an `OpExecutionMode` instruction specifying the type of subdivision

- VUID-VkShaderCreateInfoEXT-codeType-12226
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, and `stage` is VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT, `pCode` must contain an `OpExecutionMode` instruction specifying the output patch size

- VUID-VkShaderCreateInfoEXT-pPushConstantRanges-10063
  Any two elements of `pPushConstantRanges` must not include the same stage in `stageFlags`

- VUID-VkShaderCreateInfoEXT-codeType-10064
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, `flags` does not include VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT and if a push constant block is declared in a shader, then an element of `pPushConstantRanges->stageFlags` must match `stage`

- VUID-VkShaderCreateInfoEXT-codeType-10065
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, `flags` does not include VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT and if a push constant block is declared in a shader, the block must be contained inside the element of `pPushConstantRanges` that matches the stage

- VUID-VkShaderCreateInfoEXT-codeType-10383
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, `flags` does not include VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT and a resource variable is declared in a shader, the corresponding descriptor set in `pSetLayouts` must match the shader stage

- VUID-VkShaderCreateInfoEXT-codeType-10384
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, `flags` does not include VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT and a resource variable is declared in a shader, and the descriptor type is not VK_DESCRIPTOR_TYPE_MUTABLE_EXT, the corresponding descriptor set in `pSetLayouts` must match the descriptor type

- VUID-VkShaderCreateInfoEXT-codeType-10385
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, `flags` does not include VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT and a resource variable is declared in a shader as an array, the corresponding descriptor set in `pSetLayouts` must match the descriptor count

- VUID-VkShaderCreateInfoEXT-setLayoutCount-13359
  If `setLayoutCount` is not 0, pSetLayouts is not `NULL`, and `flags` does not include VK_SHADER_CREATE_INDEPENDENT_SETS_BIT_KHR, then `pSetLayouts` must be a valid pointer to an array of `setLayoutCount` valid VkDescriptorSetLayout handles

- VUID-VkShaderCreateInfoEXT-setLayoutCount-13360
  If `setLayoutCount` is not 0, pSetLayouts is not `NULL`, and `flags` includes VK_SHADER_CREATE_INDEPENDENT_SETS_BIT_KHR, then `pSetLayouts` must be a valid pointer to an array of `setLayoutCount` VkDescriptorSetLayout or `VK_NULL_HANDLE` handles

- VUID-VkShaderCreateInfoEXT-stage-12428
  If `stage` is VK_SHADER_STAGE_COMPUTE_BIT, then `flags` must not include VK_SHADER_CREATE_INDEPENDENT_SETS_BIT_KHR

- VUID-VkShaderCreateInfoEXT-codeType-10386
  If `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, `flags` does not include VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT and a resource variable is declared in a shader as an array of descriptors, then the descriptor type of that variable must not be VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK

- VUID-VkShaderCreateInfoEXT-flags-11758
  If shader64BitIndexing feature is not enabled, `flags` must not contain VK_SHADER_CREATE_64_BIT_INDEXING_BIT_EXT

- VUID-VkShaderCreateInfoEXT-setLayoutCount-12257
  `setLayoutCount` must be less than or equal to `VkPhysicalDeviceLimits`::`maxBoundDescriptorSets`

- VUID-VkShaderCreateInfoEXT-flags-11290
  If `flags` includes VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT, `setLayoutCount` must be 0

- VUID-VkShaderCreateInfoEXT-flags-11291
  If `flags` includes VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT, `pSetLayouts` must be `NULL`

- VUID-VkShaderCreateInfoEXT-flags-11370
  If `flags` includes VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT, `pushConstantRangeCount` must be 0

- VUID-VkShaderCreateInfoEXT-flags-11371
  If `flags` includes VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT, `pPushConstantRanges` must be `NULL`

- VUID-VkShaderCreateInfoEXT-flags-11292
  If `flags` includes VK_SHADER_CREATE_DESCRIPTOR_HEAP_BIT_EXT, and `codeType` is VK_SHADER_CODE_TYPE_SPIRV_EXT, all shader variables in the shader resource interface with a `DescriptorSet` and `Binding` decoration must have a mapping declared in VkShaderDescriptorSetAndBindingMappingInfoEXT::`pMappings`

- VUID-VkShaderCreateInfoEXT-stage-12445
  `stage` must not contain VK_SHADER_STAGE_RAYGEN_BIT_KHR, VK_SHADER_STAGE_ANY_HIT_BIT_KHR, VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, VK_SHADER_STAGE_MISS_BIT_KHR, VK_SHADER_STAGE_INTERSECTION_BIT_KHR, or VK_SHADER_STAGE_CALLABLE_BIT_KHR

Valid Usage (Implicit)

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

- VUID-VkShaderCreateInfoEXT-pNext-pNext
  Each `pNext` member of any structure (including this one) in the `pNext` chain must be either `NULL` or a pointer to a valid instance of VkCustomResolveCreateInfoEXT, VkPipelineShaderStageRequiredSubgroupSizeCreateInfo, VkShaderDescriptorSetAndBindingMappingInfoEXT, or VkValidationFeaturesEXT

- VUID-VkShaderCreateInfoEXT-sType-unique
  The `sType` value of each structure 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-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-2026 The Khronos Group Inc.

SPDX-License-Identifier: CC-BY-4.0