From b7afd2d47e64bf8e0b79027a9c68fe445da57b28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Meuter?= Date: Tue, 5 May 2026 16:17:17 +0200 Subject: [PATCH] Fix setDepthClipMode breaking Metal API validation when running under an iOS simulator Closes issue #457771794. All credits to the original author in https://issues.chromium.org/issues/457771794 --- src/dawn/native/metal/CommandBufferMTL.mm | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/dawn/native/metal/CommandBufferMTL.mm b/src/dawn/native/metal/CommandBufferMTL.mm index 68a73506214..ceeb922ee40 100644 --- a/src/dawn/native/metal/CommandBufferMTL.mm +++ b/src/dawn/native/metal/CommandBufferMTL.mm @@ -1972,9 +1972,8 @@ BindGroupTracker bindGroups(&storageBufferLengths, // When using and unclipped depth we need to clamp to the viewport, otherwise // Metal writes the raw value to the depth buffer, which doesn't match other // APIs. - MTLDepthClipMode clipMode = - newPipeline->HasUnclippedDepth() ? MTLDepthClipModeClamp : MTLDepthClipModeClip; - [encoder setDepthClipMode:clipMode]; + if (newPipeline->UsesFragDepth() || newPipeline->HasUnclippedDepth()) + [encoder setDepthClipMode:MTLDepthClipModeClamp]; newPipeline->Encode(encoder);