Skip to content

Class ShaderImporter

Namespace: Apogee.Rendering.Shaders
Assembly: Apogee.Rendering.dll

Slang modules into s (.ashader): each module with entry points is compiled to SPIR-V (Vulkan) and to Metal shading language (Metal), with its reflection, once without defines and once for each <Variant> its .import.xml lists. The files the compiler read (import, #include) are the artifact's dependencies, so editing a library re-imports every shader that uses it, and the library is not imported on its own. A module with no [shader(…)] entry point is not an asset: it only serves the others.

public sealed class ShaderImporter : IAssetImporter

Inheritance

object ← ShaderImporter

Implements

IAssetImporter

Inherited Members

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

Constructors

ShaderImporter(int)

public ShaderImporter(int optimization = 1)

Parameters

optimization int

Properties

Extensions

The extensions it takes, with the dot, in lower case.

public IReadOnlyList<string> Extensions { get; }

Property Value

IReadOnlyList<string>

Fingerprint

Slang's version, the optimization level and the ABI the code is for: a new compiler or a new engine layout imports again.

public string Fingerprint { get; }

Property Value

string

Name

Names the importer in the key.

public string Name { get; }

Property Value

string

Methods

Import(ImportContext)

The artifact of the asset, or null when the asset is not one (a shader module that only other shaders import): it then has no entry in the index.

public ImportResult? Import(ImportContext context)

Parameters

context ImportContext

Returns

ImportResult?

Exceptions

ContentException

The asset cannot be imported.