ShaderCompiler namespace

Classes

struct Attribute
struct AttributeInfo
Vertex attribute ("in" declaration in the vertex stage).
struct BlockInfo
std140 uniform block
struct BlockMember
class ConstFolder
Computes literal constant-folding rewrites for one fold unit.
struct Diagnostic
Error description pointing into the input file.
class Emitter
Emits the generated C++ header and the "--check" reflection dump.
class Essl100Emitter
Transforms an already-lowered modern-GLSL stage source into ESSL 100 (OpenGL ES 2.0).
struct FoldEdit
One computed rewrite: columns [Begin, End) of line Index collapse to Replacement.
struct FoldInputLine
One input line range of a fold unit (positions must be valid in the rewritable original text).
class GlslExprTokenizer
GLSL expression tokenizer (reusable outside the folder).
struct GlslInstanceMember
One scalar/vector member of the per-instance std140 block, with its baked byte offset.
class GlslReflector
Parses global-scope GLSL declarations and computes std140 layouts.
class GlslToCpp
Transpiles lowered fragment GLSL into a C++ software-renderer fragment function.
struct GlslToCppResult
Outcome of transpiling one fragment shader to C++.
struct GlslToken
One GLSL expression token with its position in the source line it came from.
class HlslEmitter
Transforms an already-lowered modern-GLSL stage source into HLSL (Shader Model 4/5).
struct MemberInfo
Member of a struct or std140 uniform block.
class Preprocessor
Object-like macro preprocessor used to produce the per-variant declaration stream for reflection.
struct Program
struct ProgramReflection
One lowered program (document plus per-variant reflection) to be emitted into a generated header.
struct ProgramVariant
class RuntimeProgram
A ".shader" program compiled at runtime, owning its sources and reflection.
struct RuntimeVariant
One variant of a runtime-compiled program: lowered stage sources plus merged reflection.
struct SamplerBinding
A sampler uniform's texture-unit assignment, taken from the program's reflection.
struct ShaderDocument
Lowered ".shader" document — directives plus raw (unpreprocessed) per-stage GLSL line streams.
class ShaderParser
Parses and lowers the ".shader" input language.
struct SourceLine
One line of source text together with its 1-based line number in the original ".shader" file.
struct StageReflection
Reflection data collected from one stage (or merged for a whole program).
struct StructInfo
User struct declaration with its computed std140 layout.
struct TextureBinding
struct TextureDirective
Texture unit assignment for a sampler uniform — from a "texture_unit(N)" uniform hint or the implicit canvas TEXTURE registration.
struct TextureInfo
Sampler uniform with its optional "texture_unit(N)" hint unit assignment.
struct Uniform
struct UniformBlock
struct UniformInfo
Loose (non-block, non-sampler) uniform.
struct VariantReflection
Reflection of one program variant (the unnamed base or a named variant), merged across stages.
class VulkanGlslEmitter
Transforms an already-lowered modern-GLSL stage source into Vulkan-flavored GLSL ("#version 450").

Enums

enum class GlslTokenType : std::uint8_t { Identifier, IntLiteral, UIntLiteral, FloatLiteral, BoolLiteral, Operator, End }
Classification of one GLSL expression token.
enum class GlslType : std::uint8_t { Float, Int, UInt, Bool, Vec2, Vec3, Vec4, IVec2, IVec3, IVec4, UVec2, UVec3, UVec4, BVec2, BVec3, BVec4, Mat2, Mat3, Mat4, Sampler2D, Sampler3D, SamplerCube, Struct }
Data type of a uniform, block member or vertex attribute.
enum RenderModeMask : std::uint32_t { RenderModeBlendMix = 0x01, RenderModeBlendAdd = 0x02, RenderModeBlendSub = 0x04, RenderModeBlendMul = 0x08, RenderModeBlendPremulAlpha = 0x10, RenderModeUnshaded = 0x20 }
"render_mode" flags (bit values match ShaderCompiler::RenderMode in the generated ShaderCompilerTypes.h)
enum class UniformType : std::uint8_t { Float, Int, UInt, Bool, Vec2, Vec3, Vec4, IVec2, IVec3, IVec4, UVec2, UVec3, UVec4, BVec2, BVec3, BVec4, Mat2, Mat3, Mat4, Sampler2D, Sampler3D, SamplerCube, Struct }
enum class RenderMode : std::uint32_t { BlendMix = 0x01, BlendAdd = 0x02, BlendSub = 0x04, BlendMul = 0x08, BlendPremulAlpha = 0x10, Unshaded = 0x20 }

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.
using FileReader = std::function<bool(StringView path, String& content)>
Reads the content of the file at path into content, returns false on failure.

Functions

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

Variables

std::uint16_t SymbolicArraySize constexpr