SlangShaderProgram

Inherits: Resource

Description

A single compiled program within a SlangShaderFile. Contains both the compiled SPIR-V and reflection metadata related to this particular program within a shader.

A compute program is built from a single entry-point; a raster program is built from a vertex and a fragment entry-point linked together. Both are listed in SlangShaderFile.programs and told apart by stages.

Properties

StringName

program_name

&""

StructTypeLayoutShape

parameters

int

slot_offset

0

int

space_offset

0

RDShaderSPIRV

spirv

int

stages

0

Vector3i

thread_group_size

Vector3i(0, 0, 0)

Dictionary

used_binding_sets

{}

Dictionary

user_attributes

{}

Methods

bool

has_stage(stage: RenderingDevice.ShaderStage) const

String

get_compile_error() const


Property Descriptions

StringName program_name = &"" 🔗

  • void set_program_name(value: StringName)

  • StringName get_program_name()

The name of this kernel. By default, this will match the entry-point function name declared in the shader.


StructTypeLayoutShape parameters 🔗

Get the reflection information of the parameters for this kernel. You typically won't need to access this, but it is used under the hood by SlangShaderTask to bind data to the correct descriptor slots.


int slot_offset = 0 🔗

  • void set_slot_offset(value: int)

  • int get_slot_offset()

The slot offset of this kernel's parameters, relative to the global parameters.


int space_offset = 0 🔗

  • void set_space_offset(value: int)

  • int get_space_offset()

The space offset of this kernel's parameters, relative to the global parameters.


RDShaderSPIRV spirv 🔗

  • void set_spirv(value: RDShaderSPIRV)

  • RDShaderSPIRV get_spirv()

The SPIR-V intermediate representation of this program, with one bytecode entry per shader stage it provides.


int stages = 0 🔗

  • void set_stages(value: int)

  • int get_stages()

The shader stages this program is built from, as a bitmask of RenderingDevice.SHADER_STAGE_*_BIT values. This is set even when a stage fails to compile, so it describes what the program is rather than what succeeded.


Vector3i thread_group_size = Vector3i(0, 0, 0) 🔗

  • void set_thread_group_size(value: Vector3i)

  • Vector3i get_thread_group_size()

The thread group size declared for this kernel.


Dictionary used_binding_sets = {} 🔗

  • void set_used_binding_sets(value: Dictionary)

  • Dictionary get_used_binding_sets()

The binding sets that are used by this kernel. The key is the binding set index, and the value is true/false.


Dictionary user_attributes = {} 🔗

  • void set_user_attributes(value: Dictionary)

  • Dictionary get_user_attributes()

Reflection information about any declared attributes on the entry-point function.


Method Descriptions

bool has_stage(stage: RenderingDevice.ShaderStage) const 🔗

Returns true if this program is built from the given shader stage.


String get_compile_error() const 🔗

Returns the compile error reported for any stage of this program, or an empty string if it compiled successfully.