Skip to content

Class CompiledShader

Namespace: Apogee.Graphics.Shaders
Assembly: Apogee.Graphics.dll

The result of compiling one Slang module for one backend: the code of each of its entry points (SPIR-V, or Metal shading language text), what the compiler learned about its parameters, and the files it read.

public sealed class CompiledShader

Inheritance

object ← CompiledShader

Inherited Members

object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.ReferenceEquals(object?, object?), object.ToString()

Constructors

CompiledShader(string, Dictionary<string, byte[]>, string, string, IReadOnlyList<string>, bool, ShaderBackend)

public CompiledShader(string moduleName, Dictionary<string, byte[]> spirv, string reflectionJson, string warnings, IReadOnlyList<string> dependencies, bool fromCache, ShaderBackend backend = ShaderBackend.Spirv)

Parameters

moduleName string

spirv Dictionary<string, byte[]>

reflectionJson string

warnings string

dependencies IReadOnlyList<string>

fromCache bool

backend ShaderBackend

Properties

Backend

What the code is for.

public ShaderBackend Backend { get; }

Property Value

ShaderBackend

Dependencies

The files read to compile it, which a cache or a hot reload watches.

public IReadOnlyList<string> Dependencies { get; }

Property Value

IReadOnlyList<string>

EntryPoints

public IReadOnlyList<string> EntryPoints { get; }

Property Value

IReadOnlyList<string>

FromCache

The result came from the on-disk cache, not from the compiler.

public bool FromCache { get; }

Property Value

bool

ModuleName

public string ModuleName { get; }

Property Value

string

ReflectionJson

Slang's reflection of the program as JSON: parameters and their bindings, thread group sizes.

public string ReflectionJson { get; }

Property Value

string

Warnings

The compiler's warnings (errors throw), empty when there are none.

public string Warnings { get; }

Property Value

string

Methods

Code(string)

The code of an entry point as a pipeline takes it.

public ShaderCode Code(string entryPoint)

Parameters

entryPoint string

Returns

ShaderCode

Msl(string)

The Metal shading language source of an entry point (the shader must have been compiled for Metal). Every entry point of a module has the whole module's source.

public string Msl(string entryPoint)

Parameters

entryPoint string

Returns

string

Spirv(string)

The SPIR-V of an entry point (the shader must have been compiled for Vulkan).

public byte[] Spirv(string entryPoint)

Parameters

entryPoint string

Returns

byte[]