# Xui.Core.Canvas.Composition.GPU

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

## Types

- [`class GpuNode`](#api-8558e7ef5623163f)
- [`enum GpuSurfaceFailure`](#api-537eeda428b42e63)
- [`interface ICompositionGpuSurface`](#api-680f4cf9241373fb)
- [`interface IGpuSurfaceContent`](#api-b60ab57a4ac64668)
- [`interface IGpuSurfaceFactory`](#api-9ac33d36f728f94e)

<a id="api-8558e7ef5623163f"></a>

## `class GpuNode`

A retained GPU leaf, presented by its runtime-owned surface.

GPU nodes have no canvas command buffers, inherited canvas paint, or children. A platform can derive from this type to own its native presentation container.

```csharp
public class GpuNode : Node
{
    public ICompositionGpuSurface? Surface { get; }

    protected override void DisposeCore();
}
```

<a id="api-106ab5f7f0bd9742"></a>

### [`void GpuNode.DisposeCore()`](#api-106ab5f7f0bd9742)


```csharp
protected override void DisposeCore();
```

Overrides release their owned content, children and platform resources, then call base.

<a id="api-86fc3aa0f70623f2"></a>

### [`ICompositionGpuSurface? GpuNode.Surface`](#api-86fc3aa0f70623f2)


```csharp
public ICompositionGpuSurface? Surface { get; }
```

The runtime-owned GPU surface, created on first declaration.


<a id="api-537eeda428b42e63"></a>

## `enum GpuSurfaceFailure`

Why a context could not present a native GPU surface.

```csharp
public enum GpuSurfaceFailure
{
    None,
    PortableFallbackRequired,
    NotSupported
}
```

<a id="api-85c9997bf6aa9c27"></a>

### [`GpuSurfaceFailure.None`](#api-85c9997bf6aa9c27)


```csharp
None
```

The native GPU surface was accepted.

<a id="api-85defc4a4bf54ba1"></a>

### [`GpuSurfaceFailure.NotSupported`](#api-85defc4a4bf54ba1)


```csharp
NotSupported
```

The runtime could not create a GPU device or native GPU surface.

<a id="api-dcfab80fd2fe3ff5"></a>

### [`GpuSurfaceFailure.PortableFallbackRequired`](#api-dcfab80fd2fe3ff5)


```csharp
PortableFallbackRequired
```

This drawing context requires portable output, for example an SVG capture or a native context under an unsupported clip. An offscreen fallback may still work.


<a id="api-680f4cf9241373fb"></a>

## `interface ICompositionGpuSurface`

Runtime-owned presentation resource for a retained GPU node.

```csharp
public interface ICompositionGpuSurface : IDisposable
{
    bool HasContent { get; }

    void RequestRender(IGpuSurfaceContent content);
}
```

<a id="api-d1dc857d04120e3d"></a>

### [`bool ICompositionGpuSurface.HasContent`](#api-d1dc857d04120e3d)


```csharp
bool HasContent { get; }
```

Whether the surface already holds a successfully presented frame.

<a id="api-ea1eb1dc7d2b5559"></a>

### [`void ICompositionGpuSurface.RequestRender(IGpuSurfaceContent content)`](#api-ea1eb1dc7d2b5559)


```csharp
void RequestRender(IGpuSurfaceContent content);
```

Schedules drawing after native layout; the runtime owns frame acquisition and presentation.


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

## `interface IGpuSurfaceContent`

A stable reference used both as a GPU surface&#39;s key and as its renderer.

Implement on a class, typically the View that owns the scene. The window calls Render on its UI thread after placing the native surface. Do not retain or dispose the borrowed target; encode and commit GPU commands during this call. Bounds are supplied by GroupOptions; target dimensions are physical pixels. Canvas paint is not inherited.

```csharp
public interface IGpuSurfaceContent
{
    void Render(IGpuRenderTarget target);
}
```

<a id="api-9d0361c385529173"></a>

### [`void IGpuSurfaceContent.Render(IGpuRenderTarget target)`](#api-9d0361c385529173)


```csharp
void Render(IGpuRenderTarget target);
```

Draws and submits one frame into the borrowed presentation target.


<a id="api-9ac33d36f728f94e"></a>

## `interface IGpuSurfaceFactory`

Runtime factory for native GPU composition surfaces owned by a window.

```csharp
public interface IGpuSurfaceFactory
{
    bool IsSupported { get; }

    ICompositionGpuSurface CreateSurface();
}
```

<a id="api-ea81db193a90e8df"></a>

### [`ICompositionGpuSurface IGpuSurfaceFactory.CreateSurface()`](#api-ea81db193a90e8df)


```csharp
ICompositionGpuSurface CreateSurface();
```

Creates a surface whose lifetime belongs to the retained composition tree.

**Throws** `A native GPU surface cannot be created on this device.`: A native GPU surface cannot be created on this device.

<a id="api-90425358bc1add6d"></a>

### [`bool IGpuSurfaceFactory.IsSupported`](#api-90425358bc1add6d)


```csharp
bool IsSupported { get; }
```

Whether native GPU presentation is available.

