# Xui.GPU.Hardware.D3D11

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

## Types

- [`class DirectXGpuDevice`](#api-eee7185348c23e2f)

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

## `class DirectXGpuDevice`

Direct3D 11 hardware GPU device implementation. Provides hardware-accelerated shader compilation and rendering on Windows.

This backend uses D3D11 for rendering and D3DCompiler for HLSL compilation. Rendering is done off-screen to a texture that can be read back to CPU memory for display via the software/2D canvas pipeline.

```csharp
public sealed class DirectXGpuDevice : IGpuDevice
{
    public string BackendName { get; }
    public bool IsDisposed { get; }

    public unsafe DirectXGpuDevice();
    public unsafe IGpuVertexShader CompileVertexShader(string source, string entryPoint);
    public unsafe IGpuFragmentShader CompileFragmentShader(string source, string entryPoint);
    public unsafe IGpuRenderTarget CreateRenderTarget(int width, int height);
    public unsafe IGpuCommandList CreateCommandList();
    public unsafe void Dispose();
}
```

<a id="api-071b7c92ba85a0b8"></a>

### [`DirectXGpuDevice.DirectXGpuDevice()`](#api-071b7c92ba85a0b8)


```csharp
public unsafe DirectXGpuDevice();
```

Creates a new Direct3D 11 GPU device.

**Throws** `Thrown if device creation fails.`: Thrown if device creation fails.

<a id="api-6de1cdce114885e6"></a>

### [`string DirectXGpuDevice.BackendName`](#api-6de1cdce114885e6)


```csharp
public string BackendName { get; }
```

Gets the name of this GPU backend (e.g., &quot;D3D11&quot;, &quot;Metal&quot;).

<a id="api-7897cc1737e90495"></a>

### [`IGpuFragmentShader DirectXGpuDevice.CompileFragmentShader(string source, string entryPoint)`](#api-7897cc1737e90495)


```csharp
public unsafe IGpuFragmentShader CompileFragmentShader(string source, string entryPoint);
```

Compiles a fragment (pixel) shader from native shader source code.

- **`source`** — The shader source (HLSL for D3D11, MSL for Metal).

- **`entryPoint`** — The name of the entry point function.

**Returns:** A compiled fragment shader.

<a id="api-1c6a8f80652a6f79"></a>

### [`IGpuVertexShader DirectXGpuDevice.CompileVertexShader(string source, string entryPoint)`](#api-1c6a8f80652a6f79)


```csharp
public unsafe IGpuVertexShader CompileVertexShader(string source, string entryPoint);
```

Compiles a vertex shader from native shader source code.

- **`source`** — The shader source (HLSL for D3D11, MSL for Metal).

- **`entryPoint`** — The name of the entry point function.

**Returns:** A compiled vertex shader.

<a id="api-d8cd7925c743bdea"></a>

### [`IGpuCommandList DirectXGpuDevice.CreateCommandList()`](#api-d8cd7925c743bdea)


```csharp
public unsafe IGpuCommandList CreateCommandList();
```

Creates a command list for recording rendering commands.

<a id="api-2953ccde1d255d08"></a>

### [`IGpuRenderTarget DirectXGpuDevice.CreateRenderTarget(int width, int height)`](#api-2953ccde1d255d08)


```csharp
public unsafe IGpuRenderTarget CreateRenderTarget(int width, int height);
```

Creates a render target texture.

- **`width`** — Width in pixels.

- **`height`** — Height in pixels.

**Returns:** A render target that can be used with a command list.

<a id="api-8b74ce6a69fe20f6"></a>

### [`void DirectXGpuDevice.Dispose()`](#api-8b74ce6a69fe20f6)


```csharp
public unsafe void Dispose();
```

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

<a id="api-aa3c0dc100bae179"></a>

### [`bool DirectXGpuDevice.IsDisposed`](#api-aa3c0dc100bae179)


```csharp
public bool IsDisposed { get; }
```

Gets whether this device has been disposed.

