Diligent Engine
 
Loading...
Searching...
No Matches
Diligent::SpecializationConstant Struct Reference

#include <PipelineState.h>

Public Attributes

const Char * Name = nullptr
 Specialization constant name as defined in the shader source.
 
SHADER_TYPE ShaderStages = SHADER_TYPE_UNKNOWN
 Shader stages this specialization constant applies to.
 
Uint32 Size = 0
 Size of the specialization constant data, in bytes.
 
const void * pData = nullptr
 Pointer to the specialization constant data.
 

Detailed Description

Pipeline state specialization constant.

Specialization constants are shader constants whose values are provided when the pipeline state is created. Their values are patched into the shader bytecode at specialization time, allowing applications to create pipeline variations without recompiling shaders and enabling the driver to optimize the resulting shader code.

Remarks
Specialization constants are supported in Vulkan (via VkSpecializationInfo) and WebGPU (via pipeline-overridable constants). Other backends will reject non-empty specialization constants.

Member Data Documentation

◆ Name

const Char* Diligent::SpecializationConstant::Name = nullptr

Specialization constant name as defined in the shader source.

In GLSL/SPIR-V, this corresponds to the name decorated with the constant_id layout qualifier. In WGSL, this corresponds to the name of an override declaration.

Must not be null.

◆ pData

const void* Diligent::SpecializationConstant::pData = nullptr

Pointer to the specialization constant data.

The data is interpreted as raw bytes and must be at least Size bytes long. Must not be null when Size > 0.

◆ ShaderStages

SHADER_TYPE Diligent::SpecializationConstant::ShaderStages = SHADER_TYPE_UNKNOWN

Shader stages this specialization constant applies to.

Specifies which shader stages use this constant. The value must be a valid combination of SHADER_TYPE flags.

◆ Size

Uint32 Diligent::SpecializationConstant::Size = 0

Size of the specialization constant data, in bytes.

Must match the size of the constant's type as declared in the shader.