Xui.GPU.Hardware.Metal
Assembly: Xui.Runtime.MacOS · C# declarations · Assembly overview
Types
class MacOSGpuDevice
Apple Metal hardware GPU device implementation. Provides hardware-accelerated shader compilation and rendering on macOS and iOS.
This backend uses the Metal framework for rendering and the Metal shader compiler for MSL shader compilation. Rendering is done off-screen to a texture that can be read back to CPU memory for display via the 2D canvas pipeline.
public sealed partial class MacOSGpuDevice : IGpuResourceDevice
{
public string BackendName { get; }
public bool IsDisposed { get; }
public MacOSGpuDevice();
public IGpuVertexShader CompileVertexShader(string source, string entryPoint);
public IGpuFragmentShader CompileFragmentShader(string source, string entryPoint);
public IGpuRenderTarget CreateRenderTarget(int width, int height);
public IGpuCommandList CreateCommandList();
public void Dispose();
}
public sealed partial class MacOSGpuDevice
{
public unsafe IGpuTexture CreateSampledTexture(int width, int height, IReadOnlyList<byte[]> mipLevels);
public unsafe IGpuVertexBuffer CreateVertexBuffer(ReadOnlySpan<byte> vertices, int stride);
}
MacOSGpuDevice.MacOSGpuDevice()
public MacOSGpuDevice();
Creates a new Metal GPU device using the system default device.
Throws Thrown if no Metal device is available.: Thrown if no Metal device is available.
string MacOSGpuDevice.BackendName
public string BackendName { get; }
Gets the name of this GPU backend (e.g., "D3D11", "Metal").
IGpuFragmentShader MacOSGpuDevice.CompileFragmentShader(string source, string entryPoint)
public 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.
IGpuVertexShader MacOSGpuDevice.CompileVertexShader(string source, string entryPoint)
public 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.
IGpuCommandList MacOSGpuDevice.CreateCommandList()
public IGpuCommandList CreateCommandList();
Creates a command list for recording rendering commands.
IGpuRenderTarget MacOSGpuDevice.CreateRenderTarget(int width, int height)
public 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.
IGpuTexture MacOSGpuDevice.CreateSampledTexture(int width, int height, IReadOnlyList<byte[]> mipLevels)
public unsafe IGpuTexture CreateSampledTexture(int width, int height, IReadOnlyList<byte[]> mipLevels);
Uploads premultiplied RGBA8 mip levels, largest first, with tightly packed rows.
IGpuVertexBuffer MacOSGpuDevice.CreateVertexBuffer(ReadOnlySpan<byte> vertices, int stride)
public unsafe IGpuVertexBuffer CreateVertexBuffer(ReadOnlySpan<byte> vertices, int stride);
Uploads immutable vertices once. The caller owns the returned buffer.
void MacOSGpuDevice.Dispose()
public void Dispose();
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
bool MacOSGpuDevice.IsDisposed
public bool IsDisposed { get; }
Gets whether this device has been disposed.