IGpuResource interface Core

Anything that owns GL handles.

The rule this interface exists for: no GL handle lives outside an IGpuResource. A lost device (WPF's D3DImage front buffer going away, a GPU reset, a context swap on the Avalonia lease) invalidates EVERY handle at once, and a single handle held in a field somewhere else is the one that keeps drawing into a dead object afterwards. With the rule, device loss is two calls on a GpuResourceSet.

public interface IGpuResource : IDisposable
Namespace
ArionUI.Gpu
Package
ArionUI.Gpu · dotnet add package ArionUI.Gpu --prerelease
Implements
IDisposable

Methods

Invalidate

void Invalidate();

Forget every handle WITHOUT calling GL: after device loss the objects are already gone, and deleting them would talk to a dead context.

Rebuild

void Rebuild();

Recreate everything from the resource's own description. Must be safe to call when nothing was invalidated (then it is a no-op) and after IGpuResource.Invalidate.