Class MslCodeGenerator
Metal Shading Language (MSL) code generator for Apple platforms (macOS, iOS). Translates IR to MSL shader code compatible with the Metal framework.
public class MslCodeGenerator : IShaderBackend
- Inheritance
-
MslCodeGenerator
- Implements
- Inherited Members
Remarks
MSL maps closely to C++14 with Metal-specific extensions. Key differences from HLSL:
- Vertex/fragment functions use [[attribute(n)]] instead of semantics
- Built-ins use [[position]], [[color(n)]], etc.
- Resource bindings use [[buffer(n)]], [[texture(n)]], [[sampler(n)]]
- Entry points are marked with [[vertex]] and [[fragment]] attributes
- Structs use attribute annotations directly on fields
Properties
Name
Gets the name of this backend (e.g., "HLSL", "MSL", "GLSL").
public string Name { get; }
Property Value
Methods
GenerateCode(IrShaderModule)
Generates MSL shader code from an IR module.
public string GenerateCode(IrShaderModule module)
Parameters
moduleIrShaderModule