# Xui.GPU.Backends.Glsl

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

## Types

- [`class GlslCodeGenerator`](#api-57eeb6ea4e512cee)

<a id="api-57eeb6ea4e512cee"></a>

## `class GlslCodeGenerator`

Emits GLSL ES 3.00 for WebGL 2 from the shared shader IR.

Define XUI_VERTEX or XUI_FRAGMENT immediately after the version line when compiling a stage. Both stages use main. Bind XuiBindings as a std140 uniform block; matrices are row-major in that buffer, matching Xui&#39;s CPU matrices. Vertex clip depth is converted from Xui&#39;s [0,w] convention to OpenGL&#39;s [-w,w]. Texture/sampler pairs become combined sampler uniforms named x_texture_TextureField_SamplerField. Unsupported IR fails explicitly; this backend does not provide a GPU device.

```csharp
public sealed class GlslCodeGenerator : IShaderBackend
{
    public string Name { get; }

    public string GenerateCode(IrShaderModule module);
}
```

<a id="api-96f6c0ebb361e6bf"></a>

### [`string GlslCodeGenerator.GenerateCode(IrShaderModule module)`](#api-96f6c0ebb361e6bf)


```csharp
public string GenerateCode(IrShaderModule module);
```

Generates a source bundle containing both compile-time-selected stages.

<a id="api-c2f96a772c9b582d"></a>

### [`string GlslCodeGenerator.Name`](#api-c2f96a772c9b582d)


```csharp
public string Name { get; }
```

Gets the source-generator backend selector.

