Table of Contents

Use Ganesh with Metal

Use Metal for GPU rendering on Apple platforms. Build a GRMtlBackendContext from an MTLDevice and an MTLCommandQueue.

Create the Ganesh context

On Apple target frameworks you can assign typed IMTLDevice and IMTLCommandQueue objects. From other targets, assign their native handles:

using var backendContext = new GRMtlBackendContext
{
    DeviceHandle = mtlDeviceHandle,
    QueueHandle = mtlCommandQueueHandle,
};

using var context = GRContext.CreateMetal(backendContext);

Describe Metal textures

Use GRMtlTextureInfo when constructing a GRBackendRenderTarget or GRBackendTexture for an existing MTLTexture. Your Metal host remains responsible for allocating and eventually releasing that texture.

After constructing the backend target or texture, return to wrapping an existing Ganesh resource for the shared SKSurface.Create calls.