ShaderCompiler::RuntimeProgram class

A ".shader" program compiled at runtime, owning its sources and reflection.

Not copyable or movable — the Program view returned by GetView() points into the owned storage.

Constructors, destructors, conversion operators

RuntimeProgram() defaulted
RuntimeProgram(const RuntimeProgram&) deleted

Public functions

auto operator=(const RuntimeProgram&) -> RuntimeProgram& deleted
auto FindVariant(StringView name) const -> const RuntimeVariant*
Returns the variant with the given name, or nullptr if not found; an empty name returns the unnamed base variant (Variants[0]).
auto GetView() const -> const Program&
Returns the artifact-struct view of the program (valid as long as this object lives).

Public variables

String Name
std::uint32_t RenderModes
"render_mode" flags (bitmask of ShaderCompiler::RenderMode; 0 when no render_mode is declared)
std::vector<RuntimeVariant> Variants

Friends

auto CompileRuntimeProgram(StringView content, StringView baseDir, const FileReader& reader, RuntimeProgram& out, Diagnostic& diag) -> bool
Compiles a ".shader" source into a RuntimeProgram.

Function documentation

bool CompileRuntimeProgram(StringView content, StringView baseDir, const FileReader& reader, RuntimeProgram& out, Diagnostic& diag)

Compiles a ".shader" source into a RuntimeProgram.

Parameters
content The raw ".shader" file content (before include expansion)
baseDir Directory that "#include" paths are resolved against
reader Reads referenced include files (the engine passes its virtual filesystem)
out Receives the compiled program
diag Receives the error location and message on failure