SlangShaderFile

Inherits: Resource

Description

Compiled Slang shader with SPIR-V and reflection information for each program it declares.

Every compiled program in the file is listed in programs. A compute entry-point becomes one program on its own; a vertex and a fragment entry-point are linked together into a single raster pass program. Check SlangShaderProgram.stages to tell them apart.

In most cases, this can be used as a drop-in replacement for RDShaderFile.

Properties

String

base_error

Array[SlangShaderProgram]

programs

StructTypeLayoutShape

parameters

Methods

RDShaderSPIRV

get_spirv(version: StringName = &"", program_index: int = 0) const

Array[StringName]

get_version_list(program_index: int = 0) const

void

set_bytecode(bytecode: RDShaderSPIRV, version: StringName = &"", program_index: int = 0)


Enumerations

enum MatrixLayout: 🔗

MatrixLayout UNKNOWN = 0

Unknown matrix layout.

MatrixLayout ROW_MAJOR = 1

Matrices are stored using row-major order.

MatrixLayout COLUMN_MAJOR = 2

Matrices are stored using column-major order.


Property Descriptions

String base_error 🔗

  • void set_base_error(value: String)

  • String get_base_error()

The base compilation error message, which indicates errors not related to a specific shader stage if non-empty. If empty, shader compilation is not necessarily successful (check each SlangShaderProgram's RDShaderSPIRV error message members).


Array[SlangShaderProgram] programs 🔗

Every program compiled from this shader file: one per compute entry-point, plus one for each vertex/fragment pair linked into a raster pass.


StructTypeLayoutShape parameters 🔗

Get the reflection information of the global parameters for this shader. 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.


Method Descriptions

RDShaderSPIRV get_spirv(version: StringName = &"", program_index: int = 0) const 🔗

Returns the SPIR-V intermediate representation of the specified program (at program_index), with one bytecode entry per shader stage it provides.


Array[StringName] get_version_list(program_index: int = 0) const 🔗

Returns the list of compiled versions for this shader. This is always empty for Slang shaders.


void set_bytecode(bytecode: RDShaderSPIRV, version: StringName = &"", program_index: int = 0) 🔗

Sets the SPIR-V bytecode that will be compiled for the specified program (at program_index).