6.9.1. SPIR-V shader reflection (dasSpirv): API-neutral descriptor + push-constant layout, host-consumed
Shader reflection for the dasSpirv SPIR-V backend: an API-neutral description of a shader’s descriptor bindings and push-constant ranges, emitted alongside the SPIR-V blob and consumed by the host (e.g. dasVulkan) to auto-build descriptor-set and pipeline layouts. The same per-global classification that emits the SPIR-V fills the reflection, so the host never re-declares set/binding/type by hand. Serialized to an array<uint> (riding the same module-global-capture rail as the blob) and decoded once at layout-build time; the wire form is versioned so producer/consumer drift fails loudly.
6.9.1.1. Type aliases
- bitfield SpirvStageFlags
- Fields:
vertex (0x1) - < used in the vertex stage
fragment (0x2) - < used in the fragment stage
compute (0x4) - < used in the compute stage
6.9.1.2. Constants
- REFLECTION_MAGIC = 0x52464c32
REFLECTION_MAGIC:uint const
6.9.1.3. Enumerations
- SpirvDescriptorKind
- Values:
uniform_buffer = 0 - < a @uniform block (UBO)
storage_buffer = 1 - < an @ssbo (SSBO)
combined_image_sampler = 2 - < a sampler2D/3D/Cube/2DArray (image + sampler in one descriptor)
storage_image = 3 - < an image2D (read-write storage image)
sampled_image = 4 - < a standalone texture2D (separate-image model)
sampler = 5 - < a standalone sampler (separate-sampler model)
6.9.1.4. Structures
- SpirvDescriptorBinding
- Fields:
set : int - < descriptor-set index (@set)
binding : int - < binding index within the set (@binding)
kind : SpirvDescriptorKind - < what kind of descriptor this is
count : int - < array size; 1 for a non-array binding
stages : SpirvStageFlags - < stages this binding is used in
- SpirvPushConstantRange
- Fields:
offset : int - < byte offset of the range (4-aligned)
size : int - < byte size of the range (4-aligned)
stages : SpirvStageFlags - < stages this range is used in
- SpirvReflection
- Fields:
stage : SpirvStageFlags - < which stage this reflection describes
entry_point : string - < entry-point name; always “main” (invariant, not serialized — decode restores it)
local_size : int3 - < compute workgroup size; (1,1,1) for graphics stages
bindings : array< SpirvDescriptorBinding> - < descriptor bindings (UBO / SSBO / image / sampler)
push_constants : array< SpirvPushConstantRange> - < push-constant ranges
6.9.1.5. Serialization
- decode_reflection(words: array<uint> ): SpirvReflection
def decode_reflection (words: array<uint>) : SpirvReflection
- Arguments:
words : array<uint>
- encode_reflection(refl: SpirvReflection ): array<uint>
def encode_reflection (refl: SpirvReflection) : array<uint>
- Arguments:
refl : SpirvReflection