[spirv-reader] Accept DepthReplacing

Bug: 42250952
Change-Id: I5fd5e2ebffa98185ecfab4ddf2290877154ae4fe
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/186962
Reviewed-by: Ben Clayton <bclayton@google.com>
diff --git a/src/tint/lang/spirv/reader/parser/function_test.cc b/src/tint/lang/spirv/reader/parser/function_test.cc
index d268ebb..d344063 100644
--- a/src/tint/lang/spirv/reader/parser/function_test.cc
+++ b/src/tint/lang/spirv/reader/parser/function_test.cc
@@ -96,6 +96,40 @@
 )");
 }
 
+TEST_F(SpirvParserTest, FragmentShader_DepthReplacing) {
+    EXPECT_IR(R"(
+               OpCapability Shader
+               OpMemoryModel Logical GLSL450
+               OpEntryPoint Fragment %main "main" %depth
+               OpExecutionMode %main OriginUpperLeft
+               OpExecutionMode %main DepthReplacing
+               OpDecorate %depth BuiltIn FragDepth
+       %void = OpTypeVoid
+        %f32 = OpTypeFloat 32
+     %f32_42 = OpConstant %f32 42.0
+%_ptr_Output_f32 = OpTypePointer Output %f32
+      %depth = OpVariable %_ptr_Output_f32 Output
+    %ep_type = OpTypeFunction %void
+       %main = OpFunction %void None %ep_type
+ %main_start = OpLabel
+               OpStore %depth %f32_42
+               OpReturn
+               OpFunctionEnd
+)",
+              R"(
+$B1: {  # root
+  %1:ptr<__out, f32, read_write> = var @builtin(frag_depth)
+}
+
+%main = @fragment func():void {
+  $B2: {
+    store %1, 42.0f
+    ret
+  }
+}
+)");
+}
+
 TEST_F(SpirvParserTest, VertexShader) {
     EXPECT_IR(R"(
                OpCapability Shader
diff --git a/src/tint/lang/spirv/reader/parser/parser.cc b/src/tint/lang/spirv/reader/parser/parser.cc
index 04622de..d6c4f60 100644
--- a/src/tint/lang/spirv/reader/parser/parser.cc
+++ b/src/tint/lang/spirv/reader/parser/parser.cc
@@ -487,7 +487,9 @@
                                            execution_mode.GetSingleWordInOperand(3),
                                            execution_mode.GetSingleWordInOperand(4));
                     break;
+                case spv::ExecutionMode::DepthReplacing:
                 case spv::ExecutionMode::OriginUpperLeft:
+                    // These are ignored as they are implicitly supported by Tint IR.
                     break;
                 default:
                     TINT_UNIMPLEMENTED() << "unhandled execution mode: " << mode;