v0.30.4 — Metal Stencil State Fix
Metal: Stencil State Translation + Stencil Pixel Format
Fixes two Metal HAL issues that caused stencil tests to be silently inert on macOS — rounded UI panels rendered as squares, clipped/stencil-masked content vanished.
Fixed
-
Stencil state translation —
CreateRenderPipelinenow translatesStencilFront/StencilBackface states (compare function, fail/depth-fail/pass operations) and read/write masks intoMTLDepthStencilState. Previously Metal kept its defaults (Always+Keep), silently disabling the stencil test. Vulkan, DX12, and GLES already did this — Metal was the only backend missing it. -
Stencil attachment pixel format — set
stencilAttachmentPixelFormaton the render pipeline descriptor for formats with stencil aspects (Depth24PlusStencil8,Depth32FloatStencil8,Stencil8). Also split depth/stencil format conditionally —Stencil8-only formats no longer incorrectly setdepthAttachmentPixelFormat. Matches Rust wgpu-hal Metal pattern. -
Depth-stencil descriptor leak —
Release(depthStencilDesc)after creating the depth-stencil state (descriptor properties copy, so the original can be freed).
Added
stencilOperationToMTL— explicit WebGPU → Metal stencil operation mapping. Required because the enum values differ (e.g. WebGPUInvert=4, MetalInvert=5).
Contributors
- @samyfodil (PR #227) — discovered and fixed Metal stencil state, verified on Apple Silicon M4.