Emit.h file
Generated C++ header emitter for ShaderCompiler.
Produces a generated header containing:
- one raw-string GLSL source pair (vertex/fragment) per program variant, with the variant's "#define NAME (1)" and "#line 1" baked at the top and the shared prelude prepended — the GLSL body is the original text with only the stage conditionals ("#ifdef/#ifndef VERTEX_STAGE|FRAGMENT_STAGE") resolved away;
- constexpr reflection arrays (uniforms, std140 blocks and their members, texture bindings, vertex attributes) per variant, tied together by ProgramVariant and Program descriptors.
The plain-struct reflection types live in the fixed "ShaderCompiler" namespace inside a shared standalone header, "ShaderCompilerTypes.h" (written via "--emit-types" and included by every generated header), so engine code can consume reflection without pulling in any program's data. Program data goes into the namespace given on the command line (default "ShaderArtifacts").
Also provides the human-readable reflection dump used by "--check".
Namespaces
- namespace ShaderCompiler
Classes
- struct ShaderCompiler::VariantReflection
- Reflection of one program variant (the unnamed base or a named variant), merged across stages.
- struct ShaderCompiler::ProgramReflection
- One lowered program (document plus per-variant reflection) to be emitted into a generated header.
- class ShaderCompiler::Emitter
- Emits the generated C++ header and the "--check" reflection dump.
Typedefs
-
using SpirvCompileFn = std::
function<bool(StringView vulkanGlsl, bool vertexStage, std:: vector<std:: uint32_t>& spirv, String& log)> - Offline SPIR-V compiler callback injected into EmitHeader.
Typedef documentation
using SpirvCompileFn = std:: function<bool(StringView vulkanGlsl, bool vertexStage, std:: vector<std:: uint32_t>& spirv, String& log)>
Offline SPIR-V compiler callback injected into EmitHeader.
Compiles the Vulkan-flavored GLSL vulkanGlsl of one stage (vertexStage selects vertex vs. fragment) to SPIR-V words in spirv, returning false (and optionally filling log) when glslang is unavailable or the compile fails. Passing an empty function omits SPIR-V (the VkVsSpirv/VkFsSpirv fields are emitted as nullptr/0). Injected by the caller so Emit stays free of the process-spawning and glslang-locating code, which lives in the offline Main.cpp.