ShaderCompiler namespace
Namespaces
- namespace VertexIdRewrite
Classes
- struct Attribute
- struct AttributeDecl
- struct AttributeInfo
- Vertex attribute ("in" declaration in the vertex stage).
- struct BlockDecl
- struct BlockInfo
- std140 uniform block
- struct BlockMember
- class ConsoleFixedFunction
- Transpiles
fixed_functionblocks into C++ effect functions over the EffectContext contract. - 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 Expr
- One expression-tree node; the type-free shape shared by the AST-based lowerings.
- struct Field
- struct FixedFunctionBlock
- One captured "void fixed_function([<target>[, <target>...]]) { ... }" block.
- struct FixedFunctionResult
- Outcome of transpiling one fixed_function block variant to C++.
- 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).
- struct Function
- struct GlobalVarDecl
- 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.
- struct Param
- class Parser
- Grows the shared typed AST (declarations + per-function statement trees) from an already-lowered modern-GLSL stage token stream.
- 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 SamplerDecl
- 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 Stmt
- struct StructDecl
- 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 TyRef
- A type plus, for Ty::Struct, the user struct name (so struct-typed members resolve their fields).
- struct Uniform
- struct UniformBlock
- struct UniformDecl
- 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.
- struct VaryingDecl
- class VulkanGlslEmitter
- Transforms an already-lowered modern-GLSL stage source into Vulkan-flavored GLSL ("#version 450").
Enums
-
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 } - enum class FixedFunctionBackend { Pvr, Gx, Psp }
- Fixed-function backend a generated aggregate header targets.
-
enum class FixedFunctionRequirements : std::
uint8_t { None = 0, NeedsTexelStep = 0x01, NeedsUniforms = 0x02, NeedsStripBuilder = 0x04, NeedsQuadAxes = 0x08 } - Optional
EffectContextfacilities an emitted function calls, as single-bit flags. -
enum class GlslTokenType : std::
uint8_t { Identifier, IntLiteral, UIntLiteral, FloatLiteral, BoolLiteral, Operator, End } - Classification of one GLSL expression token.
- enum class ExprKind { IntLit, UIntLit, FloatLit, BoolLit, Ident, Member, Index, Call, Unary, Binary, Assign, Conditional }
- Kind of an Expr node (the union across the AST-based targets).
-
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 class Ty { Void, Float, Int, UInt, Bool, Vec2, Vec3, Vec4, IVec2, IVec3, IVec4, UVec2, UVec3, UVec4, BVec2, BVec3, BVec4, Mat2, Mat3, Mat4, Sampler2D, Sampler3D, SamplerCube, Struct, Unknown }
- Scalar/vector/matrix/opaque type of the translated GLSL subset (uint/uvec kept distinct).
- enum class StmtKind { Block, VarDecl, ExprStmt, If, For, Return }
-
enum class FixedFunctionTarget : std::
uint8_t { Pvr, Gx, Psp } - One backend a "void fixed_function(...) { ... }" block can name in its parentheses.
-
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)
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 DxbcCompileFn = std::
function<bool(StringView hlsl, bool vertexStage, std:: vector<std:: uint8_t>& dxbc, String& log)> - Offline DXBC compiler callback injected into EmitHeader.
-
using ExprPtr = std::
unique_ptr<Expr> -
using StmtPtr = std::
unique_ptr<Stmt> -
using FileReader = std::
function<bool(StringView path, String& content)> - Reads the content of the file at
pathintocontent, returns false on failure.
Functions
- auto IsQualifier(StringView k) -> bool
- True for a type-qualifier keyword the AST parsers skip (precision / interpolation / const).
-
auto BinPrec(StringView op) -> std::
int32_t - auto MakeExpr(ExprKind kind, String text = {}) -> ExprPtr
- Allocates an Expr of the given kind, optionally carrying literal/identifier/operator text.
-
auto TokenizeStage(StringView glsl,
std::
vector<GlslToken>& tokens, String& reason) -> bool - auto IsMatrix(Ty t) -> bool
- auto IsVector(Ty t) -> bool
- auto IsSampler(Ty t) -> bool
-
auto Comps(Ty t) -> std::
int32_t - auto BaseScalar(Ty t) -> Ty
-
auto MakeVec(Ty scalar,
std::
int32_t n) -> Ty - auto MatrixColumn(Ty t) -> Ty
- auto TryBuiltinType(StringView k, Ty& out) -> bool
- auto MakeStmt(StmtKind kind) -> StmtPtr
- auto CompileRuntimeProgram(StringView content, StringView baseDir, const FileReader& reader, RuntimeProgram& out, Diagnostic& diag) -> bool
- Compiles a ".shader" source into a RuntimeProgram.
- auto FixedFunctionTargetName(FixedFunctionTarget target) -> const char*
- Spelling of
targetas it is written inside a block's parentheses. -
auto FixedFunctionTargetList(const std::
vector<FixedFunctionTarget>& targets) -> String - The target list of a block, spelled the way the block declares it — e.g.
pvr, psp(empty for the generic block).
Variables
-
std::
uint16_t SymbolicArraySize constexpr