MslEmitter class
#include <Utilities/ShaderCompiler/Msl.h>
Transforms an already-lowered modern-GLSL stage source into Metal Shading Language.
Public static variables
- static const char* VertexEntryPoint constexpr
- Entry point name of the emitted vertex function.
- static const char* FragmentEntryPoint constexpr
- Entry point name of the emitted fragment function.
-
static std::
int32_t VertexBufferIndex constexpr [[buffer(N)]]index the vertex stream is bound at
Public static functions
- static auto Transform(StringView modernSource, bool vertexStage, const StageReflection& reflection, String& out, Diagnostic& diag) -> bool
Function documentation
static bool ShaderCompiler:: MslEmitter:: Transform(StringView modernSource,
bool vertexStage,
const StageReflection& reflection,
String& out,
Diagnostic& diag)
Transforms modernSource (as produced by ShaderParser::BuildStageSource) into MSL, writing the result to out. vertexStage selects the vertex-vs-fragment lowering; reflection (the MERGED per-variant reflection) supplies the buffer / texture index assignments, the loose-uniform _Globals layout and the std140 offsets the emitted structs are checked against. Returns false and fills diag when the source uses a construct the emitter does not handle.
Variable documentation
static std:: int32_t ShaderCompiler:: MslEmitter:: VertexBufferIndex constexpr
[[buffer(N)]] index the vertex stream is bound at
Chosen at the top of Metal's 31-slot buffer table so it never collides with the _Globals block (buffer 0) and the std140 blocks (buffers 1..N) that follow the reflection order. The Metal backend's vertex descriptor uses the same index.