# Xui.GPU.Backends.Metal

Assembly: **Xui.Core** · [C# declarations](index.cs) · [Assembly overview](../index.md)

## Types

- [`class MslCodeGenerator`](#api-daacfeeccac8cc12)

<a id="api-daacfeeccac8cc12"></a>

## `class MslCodeGenerator`

Metal Shading Language (MSL) code generator for Apple platforms (macOS, iOS). Translates IR to MSL shader code compatible with the Metal framework.

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

```csharp
public class MslCodeGenerator : IShaderBackend
{
    public string Name { get; }

    public string GenerateCode(IrShaderModule module);
}
```

<a id="api-cf4d3de15b07e03f"></a>

### [`string MslCodeGenerator.GenerateCode(IrShaderModule module)`](#api-cf4d3de15b07e03f)


```csharp
public string GenerateCode(IrShaderModule module);
```

Generates MSL shader code from an IR module.

<a id="api-d1016602dcf87a63"></a>

### [`string MslCodeGenerator.Name`](#api-d1016602dcf87a63)


```csharp
public string Name { get; }
```

Gets the name of this backend (e.g., &quot;HLSL&quot;, &quot;MSL&quot;, &quot;GLSL&quot;).

