gpu::metal
cheatah-gpu v0.5.1-alpha — Biome Standard 0.6.5-alpha
import gpu.metal is the Apple native interface: a native Metal backend kept as true to the Metal API as possible, so Apple users get first-class performance and Metal-only features instead of a translation layer. There is no "easy" layer above it — cheatah-gpu's one value-add is the typing fix, so a cheatah program passes plain numbers and object tokens and writes no casts (see handles.hpp). Thin bindings over the Metal C/Objective-C API; Slang authoring → Metal via Slang's Metal target.
Status: working on Apple hardware — off Apple the lane is emulated and executes no MSL, so a green run there proves nothing about a shader.
The backend builds and runs under CMake via -DCHEATAH_GPU_BUILD_METAL=ON (ON by default on Apple): cmake/Metal.cmake uses the vendored Apple metal-cpp in ../../third_party/metal-cpp (no download), and the mtl:compute / mtl:multiline / mtl:texture ctests run on the GPU on Apple and on the software emulator ([emulated/](emulated)) off Apple. scripts/metal_gate.sh runs the same suite.
Why native Metal first on Apple
On Apple platforms the native Metal path is preferred over running Vulkan through MoltenVK: lower overhead, full access to Metal-only features, and no translation surprises. The build reflects this precedence: ../../cmake/Vulkan.cmake only falls back to MoltenVK when this backend is unavailable or explicitly disabled (-DCHEATAH_GPU_METAL_OK=OFF). With the native backend shipped, macOS runs Metal by default; MoltenVK remains the deliberate opt-out path.
Concepts
Handle— A native Metal object handle — always a pointer to anMTL::/NS::object.
Functions
The cheatah int token standing for a native Metal object.
nullptr maps to 0.
native | the Metal object pointer to convert. |
the object as a cheatah int.
O(1).
none.
MetalHandles.RoundTripThe native Metal object a cheatah int token stands for.
0 maps to nullptr.
T | the Metal object pointer type to recover (e.g. |
value | the cheatah int token, as produced by token. |
the native object pointer.
O(1).
none.
MetalHandles.RoundTripConstants & variables
Types
::MTL::AccelerationStructurePassSampleBufferAttachmentDescriptor AccelerationStructurePassSampleBufferAttachmentDescriptor
#
::MTL::AccelerationStructurePassSampleBufferAttachmentDescriptorArray AccelerationStructurePassSampleBufferAttachmentDescriptorArray
#
::MTL::AccelerationStructureTriangleGeometryDescriptor AccelerationStructureTriangleGeometryDescriptor
#
::MTL::AccelerationStructureBoundingBoxGeometryDescriptor AccelerationStructureBoundingBoxGeometryDescriptor
#
::MTL::AccelerationStructureMotionTriangleGeometryDescriptor AccelerationStructureMotionTriangleGeometryDescriptor
#
::MTL::AccelerationStructureMotionBoundingBoxGeometryDescriptor AccelerationStructureMotionBoundingBoxGeometryDescriptor
#
::MTL::AccelerationStructureCurveGeometryDescriptor AccelerationStructureCurveGeometryDescriptor
#
::MTL::AccelerationStructureMotionCurveGeometryDescriptor AccelerationStructureMotionCurveGeometryDescriptor
#
::MTL::IndirectInstanceAccelerationStructureDescriptor IndirectInstanceAccelerationStructureDescriptor
#
::MTL::BlitPassSampleBufferAttachmentDescriptorArray BlitPassSampleBufferAttachmentDescriptorArray
#
::MTL::ComputePassSampleBufferAttachmentDescriptor ComputePassSampleBufferAttachmentDescriptor
#
::MTL::ComputePassSampleBufferAttachmentDescriptorArray ComputePassSampleBufferAttachmentDescriptorArray
#
::MTL::RenderPassSampleBufferAttachmentDescriptorArray RenderPassSampleBufferAttachmentDescriptorArray
#
::MTL::RenderPipelineColorAttachmentDescriptorArray RenderPipelineColorAttachmentDescriptorArray
#
::MTL::TileRenderPipelineColorAttachmentDescriptor TileRenderPipelineColorAttachmentDescriptor
#
::MTL::TileRenderPipelineColorAttachmentDescriptorArray TileRenderPipelineColorAttachmentDescriptorArray
#
::MTL::ResourceStatePassSampleBufferAttachmentDescriptor ResourceStatePassSampleBufferAttachmentDescriptor
#
::MTL::ResourceStatePassSampleBufferAttachmentDescriptorArray ResourceStatePassSampleBufferAttachmentDescriptorArray
#
::MTL::AccelerationStructureInstanceDescriptorType AccelerationStructureInstanceDescriptorType
#
