Skip to content

Namespace Apogee.Graphics.Metal

Classes

MetalBindlessHeap

The bindless textures, samplers and storage images as one Metal argument buffer, buffer 1 of every shader that reads them (see ParameterBlock<BindlessResources> in common.slang). In an argument buffer of tier 2 each resource of an array takes one 8-byte slot and a struct's members follow one another, so the buffer is the runs of in the order the shader block declares them: the 16 384 2D textures, the 256 samplers, then the cube, 2D-array, 3D and unsigned-integer texture arrays (16 384 each) and the 256 storage images. A slot holds the resource's GPU resource id. Metal has no aliasing: on Vulkan all the sampled arrays are one descriptor binding, here each is a run of its own, so a sampled texture's id is written into the same index of every sampled run and the shader reads it through the array of its type. The textures and samplers are made resident through the device's residency set.

MetalBuffer

A Metal buffer. Device-local buffers are private (the GPU's), upload and readback buffers are shared and mapped for their whole life.

MetalCommandRecorder

A Metal command buffer being recorded. Metal has encoders where Vulkan has one command buffer: this opens the one the next command needs (render, compute or blit) and ends the one that is open. Metal does not order what a shader reaches through an address or an argument buffer, so the encoders form a chain, each waiting for a fence that the one before it updates: that is what the barriers of the render graph mean here (there are no image layouts to change, so does nothing by itself).

MetalDevice

The Metal implementation of (macOS 15 and later, on a GPU with Metal 3 and tier 2 argument buffers: Apple silicon and the Intel Macs of 2017 and later). It owns one command queue and a residency set: everything the GPU reaches through an address or an argument buffer must be resident, so every buffer and texture is added to the set when it is made.

MetalException

A Metal call failed or the machine cannot do what the engine needs; the message says which.

MetalFrameLoop

The Metal frame loop: a few frames in flight, each with its own upload arena and command buffer, and one shared event as the timeline (its value is the number of frames the GPU has finished). With a swapchain it takes the next drawable and presents it; without one it renders headless. GPU timings are not measured yet, so stays empty.

MetalImage

A Metal texture, or a window's drawable texture that is borrowed for a frame ().

MetalImageView

A view of a Metal texture. The image's own view borrows the texture; views made with own theirs.

MetalImmediateContext

Records a command buffer, commits it and waits for it: for loading and tools. The calls are serialized.

MetalPipeline

A Metal compute pipeline, or a render pipeline with the fixed-function state Metal sets on the encoder (depth test, culling, winding).

MetalSampler

MetalSwapchain

The images of a window: a CAMetalLayer that SDL made for it (the window needs ). The format is BGRA8 UNORM, like the Vulkan swapchain's: shaders write sRGB-encoded values themselves. A frame takes the layer's next drawable (Acquire) and presents it with its command buffer.