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);