diff --git a/src/writer/hlsl/generator_impl.cc b/src/writer/hlsl/generator_impl.cc index 1616e65c6b..aa14cc16c9 100644 --- a/src/writer/hlsl/generator_impl.cc +++ b/src/writer/hlsl/generator_impl.cc @@ -58,15 +58,6 @@ namespace { const char kTempNamePrefix[] = "tint_tmp"; const char kSpecConstantPrefix[] = "WGSL_SPEC_CONSTANT_"; -bool last_is_break_or_fallthrough(const ast::BlockStatement* stmts) { - if (stmts->empty()) { - return false; - } - - return stmts->last()->Is() || - stmts->last()->Is(); -} - const char* image_format_to_rwtexture_type(ast::ImageFormat image_format) { switch (image_format) { case ast::ImageFormat::kRgba8Unorm: @@ -2019,7 +2010,8 @@ std::string GeneratorImpl::generate_builtin_name( return ""; } -bool GeneratorImpl::EmitCase(ast::CaseStatement* stmt) { +bool GeneratorImpl::EmitCase(ast::SwitchStatement* s, size_t case_idx) { + auto* stmt = s->body()[case_idx]; if (stmt->IsDefault()) { line() << "default: {"; } else { @@ -2036,17 +2028,32 @@ bool GeneratorImpl::EmitCase(ast::CaseStatement* stmt) { } } - { - ScopedIndent si(this); - if (!EmitStatements(stmt->body()->statements())) { + increment_indent(); + TINT_DEFER({ + decrement_indent(); + line() << "}"; + }); + + // Emit the case statement + if (!EmitStatements(stmt->body()->statements())) { + return false; + } + + // Inline all fallthrough case statements. FXC cannot handle fallthroughs. + while (tint::Is(stmt->body()->last())) { + case_idx++; + stmt = s->body()[case_idx]; + // Generate each fallthrough case statement in a new block. This is done to + // prevent symbol collision of variables declared in these cases statements. + if (!EmitBlock(stmt->body())) { return false; } - if (!last_is_break_or_fallthrough(stmt->body())) { - line() << "break;"; - } } - line() << "}"; + if (!tint::IsAnyOf( + stmt->body()->last())) { + line() << "break;"; + } return true; } @@ -2900,8 +2907,8 @@ bool GeneratorImpl::EmitSwitch(ast::SwitchStatement* stmt) { { ScopedIndent si(this); - for (auto* s : stmt->body()) { - if (!EmitCase(s)) { + for (size_t i = 0; i < stmt->body().size(); i++) { + if (!EmitCase(stmt, i)) { return false; } } diff --git a/src/writer/hlsl/generator_impl.h b/src/writer/hlsl/generator_impl.h index 8874b2d65e..7ec64ff70e 100644 --- a/src/writer/hlsl/generator_impl.h +++ b/src/writer/hlsl/generator_impl.h @@ -196,9 +196,10 @@ class GeneratorImpl : public TextGenerator { ast::CallExpression* expr, const sem::Intrinsic* intrinsic); /// Handles a case statement - /// @param stmt the statement + /// @param s the switch statement + /// @param case_idx the index of the switch case in the switch statement /// @returns true if the statement was emitted successfully - bool EmitCase(ast::CaseStatement* stmt); + bool EmitCase(ast::SwitchStatement* s, size_t case_idx); /// Handles generating constructor expressions /// @param out the output of the expression stream /// @param expr the constructor expression diff --git a/src/writer/hlsl/generator_impl_case_test.cc b/src/writer/hlsl/generator_impl_case_test.cc index 6ecd75552e..7fe6e3191f 100644 --- a/src/writer/hlsl/generator_impl_case_test.cc +++ b/src/writer/hlsl/generator_impl_case_test.cc @@ -31,7 +31,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case) { gen.increment_indent(); - ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error(); + ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error(); EXPECT_EQ(gen.result(), R"( case 5: { break; } @@ -46,7 +46,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_BreaksByDefault) { gen.increment_indent(); - ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error(); + ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error(); EXPECT_EQ(gen.result(), R"( case 5: { break; } @@ -55,7 +55,9 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_BreaksByDefault) { TEST_F(HlslGeneratorImplTest_Case, Emit_Case_WithFallthrough) { auto* s = - Switch(1, Case(Literal(5), Block(create())), + Switch(1, // + Case(Literal(4), Block(create())), // + Case(Literal(5), Block(create())), // DefaultCase()); WrapInFunction(s); @@ -63,9 +65,13 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_WithFallthrough) { gen.increment_indent(); - ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error(); - EXPECT_EQ(gen.result(), R"( case 5: { + ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error(); + EXPECT_EQ(gen.result(), R"( case 4: { /* fallthrough */ + { + return; + } + break; } )"); } @@ -80,7 +86,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_MultipleSelectors) { gen.increment_indent(); - ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error(); + ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error(); EXPECT_EQ(gen.result(), R"( case 5: case 6: { break; @@ -96,7 +102,7 @@ TEST_F(HlslGeneratorImplTest_Case, Emit_Case_Default) { gen.increment_indent(); - ASSERT_TRUE(gen.EmitCase(s->body()[0])) << gen.error(); + ASSERT_TRUE(gen.EmitCase(s, 0)) << gen.error(); EXPECT_EQ(gen.result(), R"( default: { break; } diff --git a/test/switch/fallthrough.wgsl.expected.hlsl b/test/switch/fallthrough.wgsl.expected.hlsl index 21a359b51e..dc4b920c0c 100644 --- a/test/switch/fallthrough.wgsl.expected.hlsl +++ b/test/switch/fallthrough.wgsl.expected.hlsl @@ -1,11 +1,12 @@ -SKIP: FAILED - [numthreads(1, 1, 1)] void f() { int i = 0; switch(i) { case 0: { /* fallthrough */ + { + break; + } } default: { break; @@ -13,5 +14,3 @@ void f() { } return; } -C:\src\tint\test\Shader@0x000001AF1A4F6940(5,5): error X3533: non-empty case statements must have break or return - diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl index 7abd8f9461..4db0e46aff 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToCase.spvasm.expected.hlsl @@ -4,6 +4,9 @@ void main_1() { switch(42u) { case 20u: { /* fallthrough */ + { + } + break; } case 40u: { break; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl index bd88cfc437..debf902ee4 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_CaseTailToDefaultNotMerge.spvasm.expected.hlsl @@ -4,6 +4,9 @@ void main_1() { switch(42u) { case 20u: { /* fallthrough */ + { + } + break; } default: { break; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl index bb3c3e0e3e..9513a68fb1 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_Fallthrough_DefaultToCase.spvasm.expected.hlsl @@ -4,6 +4,9 @@ void main_1() { switch(42u) { default: { /* fallthrough */ + { + } + break; } case 40u: { break; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl index b6dc56035c..2c99195284 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfBreak_In_SwitchCase.spvasm.expected.hlsl @@ -10,6 +10,13 @@ void main_1() { } default: { /* fallthrough */ + { + if (false) { + } else { + break; + } + } + break; } case 50u: { if (false) { diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl index bf4b8f3218..7f1c3f17ac 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_IfFallthrough_In_SwitchCase.spvasm.expected.hlsl @@ -9,9 +9,22 @@ void main_1() { break; } /* fallthrough */ + { + /* fallthrough */ + } + { + if (false) { + } + } + break; } default: { /* fallthrough */ + { + if (false) { + } + } + break; } case 50u: { if (false) { diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl index 9bc5b7f0df..58535aa8be 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Nest_If_In_SwitchCase.spvasm.expected.hlsl @@ -9,6 +9,11 @@ void main_1() { } default: { /* fallthrough */ + { + if (false) { + } + } + break; } case 50u: { if (false) { diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl index 790a128400..257757143d 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough.spvasm.expected.hlsl @@ -4,12 +4,18 @@ void main_1() { switch(42u) { case 30u: { /* fallthrough */ + { + } + break; } case 50u: { break; } case 20u: { /* fallthrough */ + { + } + break; } case 40u: { break; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl index 1d875732b9..1f6f81bd17 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromCaseToDefaultToCase.spvasm.expected.hlsl @@ -4,9 +4,18 @@ void main_1() { switch(42u) { case 20u: { /* fallthrough */ + { + /* fallthrough */ + } + { + } + break; } default: { /* fallthrough */ + { + } + break; } case 30u: { break; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl index 1a011d02ad..945e9686c6 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_FromDefault.spvasm.expected.hlsl @@ -7,9 +7,18 @@ void main_1() { } default: { /* fallthrough */ + { + /* fallthrough */ + } + { + } + break; } case 30u: { /* fallthrough */ + { + } + break; } case 40u: { break; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl index 790a128400..257757143d 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_RespectSwitchCaseFallthrough_Interleaved.spvasm.expected.hlsl @@ -4,12 +4,18 @@ void main_1() { switch(42u) { case 30u: { /* fallthrough */ + { + } + break; } case 50u: { break; } case 20u: { /* fallthrough */ + { + } + break; } case 40u: { break; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl index 3e5b1e27c8..07fe5eb580 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Switch_DefaultSameAsACase.spvasm.expected.hlsl @@ -10,6 +10,9 @@ void main_1() { } default: { /* fallthrough */ + { + } + break; } case 30u: { break; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl index e0369bc2f1..1a65f4db41 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_Fallthrough_Fallthrough_Same.spvasm.expected.hlsl @@ -6,6 +6,10 @@ void main_1() { case 20u: { var_1 = 20u; /* fallthrough */ + { + var_1 = 30u; + } + break; } case 30u: { var_1 = 30u; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl index 6096ec8402..e91d4197d1 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnFalse.spvasm.expected.hlsl @@ -9,6 +9,10 @@ void main_1() { break; } /* fallthrough */ + { + var_1 = 30u; + } + break; } case 30u: { var_1 = 30u; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl index 9233203e1b..046b1e61f8 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_BranchConditional_SwitchBreak_Fallthrough_OnTrue.spvasm.expected.hlsl @@ -10,6 +10,10 @@ void main_1() { break; } /* fallthrough */ + { + var_1 = 30u; + } + break; } case 30u: { var_1 = 30u; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl index e0369bc2f1..1a65f4db41 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Branch_Fallthrough.spvasm.expected.hlsl @@ -6,6 +6,10 @@ void main_1() { case 20u: { var_1 = 20u; /* fallthrough */ + { + var_1 = 30u; + } + break; } case 30u: { var_1 = 30u; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl index 41e966a0b8..66c5986149 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_EmitBody_Switch_DefaultIsCase_WithDupCase.spvasm.expected.hlsl @@ -13,6 +13,10 @@ void main_1() { } default: { /* fallthrough */ + { + var_1 = 30u; + } + break; } case 30u: { var_1 = 30u; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl index a018399c91..f8e1ca9a4c 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_FindSwitchCaseHeaders_CaseIsDefault.spvasm.expected.hlsl @@ -4,6 +4,9 @@ void main_1() { switch(42u) { default: { /* fallthrough */ + { + } + break; } case 200u: { break; diff --git a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl index 08cf13fc88..05eab6ef71 100644 --- a/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserCFGTest_TerminatorsAreValid_Switch.spvasm.expected.hlsl @@ -4,6 +4,9 @@ void main_1() { switch(42u) { case 20u: { /* fallthrough */ + { + } + break; } case 30u: { break; diff --git a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl index 8d07dd476c..a9c80aefa8 100644 --- a/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl +++ b/test/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_InMerge_PredecessorsDominatdByNestedSwitchCase.spvasm.expected.hlsl @@ -7,9 +7,30 @@ void main_1() { switch(1u) { default: { /* fallthrough */ + { + /* fallthrough */ + } + { + if (true) { + } else { + x_41_phi = 0u; + break; + } + x_41_phi = 1u; + } + break; } case 0u: { /* fallthrough */ + { + if (true) { + } else { + x_41_phi = 0u; + break; + } + x_41_phi = 1u; + } + break; } case 1u: { if (true) { diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl index 4ab54a0e5f..336b952b16 100755 --- a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.hlsl @@ -1,4 +1,4 @@ -SKIP: FAILED +SKIP: https://github.com/microsoft/DirectXShaderCompiler/issues/3894 static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); static float array0[3] = (float[3])0; @@ -31,6 +31,11 @@ void main_1() { } array0[c] = 1.0f; /* fallthrough */ + { + array1[0] = 1.0f; + array1[c] = 1.0f; + } + break; } case 61: { array1[0] = 1.0f; @@ -72,13 +77,3 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) { const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; return tint_symbol_5; } -C:\src\tint\test\Shader@0x0000019491823870(15,8-20): warning X3556: integer modulus may be much slower, try using uints if possible. -C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000019491823870(23,9): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x0000019491823870(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll - diff --git a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl index 1a4ffc5b5c..336b952b16 100755 --- a/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.hlsl @@ -1,4 +1,4 @@ -SKIP: FAILED +SKIP: https://github.com/microsoft/DirectXShaderCompiler/issues/3894 static float4 gl_FragCoord = float4(0.0f, 0.0f, 0.0f, 0.0f); static float array0[3] = (float[3])0; @@ -31,6 +31,11 @@ void main_1() { } array0[c] = 1.0f; /* fallthrough */ + { + array1[0] = 1.0f; + array1[c] = 1.0f; + } + break; } case 61: { array1[0] = 1.0f; @@ -72,13 +77,3 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) { const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; return tint_symbol_5; } -C:\src\tint\test\Shader@0x0000026803D7D2F0(15,8-20): warning X3556: integer modulus may be much slower, try using uints if possible. -C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll -C:\src\tint\test\Shader@0x0000026803D7D2F0(23,9): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x0000026803D7D2F0(24,11-22): warning X3557: loop doesn't seem to do anything, forcing loop to unroll - diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl index edf514e9c8..01a9ed0f00 100644 --- a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.spvasm.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[5]; }; @@ -27,6 +25,10 @@ void main_1() { case 1: { count0 = (count0 + 1); /* fallthrough */ + { + count1 = (count1 + 1); + } + break; } case 2: case 3: { @@ -78,6 +80,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x000001CD53C8DD00(24,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000001CD53C8DD00(28,7): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl index cea07e1954..01a9ed0f00 100644 --- a/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-inst-combine-and-or-xor-switch/0-opt.wgsl.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[5]; }; @@ -27,6 +25,10 @@ void main_1() { case 1: { count0 = (count0 + 1); /* fallthrough */ + { + count1 = (count1 + 1); + } + break; } case 2: case 3: { @@ -78,6 +80,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x000001A41A83AF00(24,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000001A41A83AF00(28,7): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl index f8db992083..d153ad0e7d 100644 --- a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.spvasm.expected.hlsl @@ -17,19 +17,52 @@ void main_1() { return; } /* fallthrough */ + { + if (true) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_43 = asint(x_6[1].x); + const int x_46 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + if (false) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_56 = float(x_55); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + if (false) { + return; + } + if (true) { + return; + } + { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + } + } + } + } + } + break; } case 1: { if (true) { - const uint scalar_offset_1 = ((16u * uint(0))) / 4; - const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); const int x_43 = asint(x_6[1].x); const int x_46 = asint(x_6[1].x); - const uint scalar_offset_2 = ((16u * uint(0))) / 4; - const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49)); if (false) { - const uint scalar_offset_3 = ((16u * uint(0))) / 4; - const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); const float x_56 = float(x_55); x_GLF_color = float4(x_56, x_56, x_56, x_56); while (true) { diff --git a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl index f8db992083..d153ad0e7d 100644 --- a/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-loop-returns-behind-true-and-false/0-opt.wgsl.expected.hlsl @@ -17,19 +17,52 @@ void main_1() { return; } /* fallthrough */ + { + if (true) { + const uint scalar_offset_1 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const int x_43 = asint(x_6[1].x); + const int x_46 = asint(x_6[1].x); + const uint scalar_offset_2 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49)); + if (false) { + const uint scalar_offset_3 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const float x_56 = float(x_55); + x_GLF_color = float4(x_56, x_56, x_56, x_56); + while (true) { + x_GLF_global_loop_count = (x_GLF_global_loop_count + 1); + if (false) { + return; + } + if (true) { + return; + } + { + if ((x_GLF_global_loop_count < 100)) { + } else { + break; + } + } + } + } + } + } + break; } case 1: { if (true) { - const uint scalar_offset_1 = ((16u * uint(0))) / 4; - const int x_40 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]); + const uint scalar_offset_4 = ((16u * uint(0))) / 4; + const int x_40 = asint(x_6[scalar_offset_4 / 4][scalar_offset_4 % 4]); const int x_43 = asint(x_6[1].x); const int x_46 = asint(x_6[1].x); - const uint scalar_offset_2 = ((16u * uint(0))) / 4; - const int x_49 = asint(x_6[scalar_offset_2 / 4][scalar_offset_2 % 4]); + const uint scalar_offset_5 = ((16u * uint(0))) / 4; + const int x_49 = asint(x_6[scalar_offset_5 / 4][scalar_offset_5 % 4]); x_GLF_color = float4(float(x_40), float(x_43), float(x_46), float(x_49)); if (false) { - const uint scalar_offset_3 = ((16u * uint(0))) / 4; - const int x_55 = asint(x_6[scalar_offset_3 / 4][scalar_offset_3 % 4]); + const uint scalar_offset_6 = ((16u * uint(0))) / 4; + const int x_55 = asint(x_6[scalar_offset_6 / 4][scalar_offset_6 % 4]); const float x_56 = float(x_55); x_GLF_color = float4(x_56, x_56, x_56, x_56); while (true) { diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl index cb6868a4b4..47c3b720c2 100644 --- a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.spvasm.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; }; @@ -31,9 +29,20 @@ void main_1() { const float4 x_43 = func_(); x_GLF_color = x_43; /* fallthrough */ + { + /* fallthrough */ + } + { + x_GLF_color.y = 0.0f; + } + break; } default: { /* fallthrough */ + { + x_GLF_color.y = 0.0f; + } + break; } case 0: { x_GLF_color.y = 0.0f; @@ -60,8 +69,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x00000183AD3AB240(28,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x00000183AD3AB240(33,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x00000183AD3AB240(32,7): error X3537: Fall-throughs in switch statements are not allowed. -C:\src\tint\test\Shader@0x00000183AD3AB240(35,7): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl index e4348c5b8e..47c3b720c2 100644 --- a/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-ssa-rewrite-case-with-default/0-opt.wgsl.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; }; @@ -31,9 +29,20 @@ void main_1() { const float4 x_43 = func_(); x_GLF_color = x_43; /* fallthrough */ + { + /* fallthrough */ + } + { + x_GLF_color.y = 0.0f; + } + break; } default: { /* fallthrough */ + { + x_GLF_color.y = 0.0f; + } + break; } case 0: { x_GLF_color.y = 0.0f; @@ -60,8 +69,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x0000021C30D8F880(28,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x0000021C30D8F880(33,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x0000021C30D8F880(32,7): error X3537: Fall-throughs in switch statements are not allowed. -C:\src\tint\test\Shader@0x0000021C30D8F880(35,7): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl index 80249a8c47..6b8df2b2a3 100644 --- a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.spvasm.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; }; @@ -14,6 +12,9 @@ void main_1() { case 3: { a = 1; /* fallthrough */ + { + } + break; } case 4: { break; @@ -44,6 +45,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x0000025EFE826FC0(11,5): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x0000025EFE826FC0(15,5): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl index d7b3211d8c..6b8df2b2a3 100644 --- a/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/cov-val-cfg-case-fallthrough/0-opt.wgsl.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; }; @@ -14,6 +12,9 @@ void main_1() { case 3: { a = 1; /* fallthrough */ + { + } + break; } case 4: { break; @@ -44,6 +45,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x000001FDE7828C30(11,5): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000001FDE7828C30(15,5): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl index 06a84957d3..9cdb063260 100644 --- a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.spvasm.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; }; @@ -21,6 +19,11 @@ void main_1() { case 0: { x_43_phi = 1.0f; /* fallthrough */ + { + data[x_39] = x_43_phi; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + break; } case 1: { data[x_39] = x_43_phi; @@ -48,6 +51,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x0000027AB59F7F40(19,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x0000027AB59F7F40(22,7): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl index 0910790bfd..9cdb063260 100644 --- a/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/if-and-switch/0.wgsl.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; }; @@ -21,6 +19,11 @@ void main_1() { case 0: { x_43_phi = 1.0f; /* fallthrough */ + { + data[x_39] = x_43_phi; + x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); + } + break; } case 1: { data[x_39] = x_43_phi; @@ -48,6 +51,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x0000020777179050(19,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x0000020777179050(22,7): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl index 75f1ec9ab2..17a9f12954 100644 --- a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.spvasm.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; @@ -26,6 +24,9 @@ void main_1() { } } /* fallthrough */ + { + } + break; } case 42: { break; @@ -55,6 +56,3 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) { const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; return tint_symbol_5; } -C:\src\tint\test\Shader@0x000001A268ED57F0(11,5): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000001A268ED57F0(27,5): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl index 734bbd1228..17a9f12954 100644 --- a/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/nested-switch-break-discard/0-opt.wgsl.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f); cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; @@ -26,6 +24,9 @@ void main_1() { } } /* fallthrough */ + { + } + break; } case 42: { break; @@ -55,6 +56,3 @@ tint_symbol_2 main(tint_symbol_1 tint_symbol) { const tint_symbol_2 tint_symbol_5 = {tint_symbol_3.x_GLF_color_1}; return tint_symbol_5; } -C:\src\tint\test\Shader@0x00000267DEB27120(11,5): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x00000267DEB27120(27,5): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl index a4328559ba..5c6be43217 100644 --- a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.spvasm.expected.hlsl @@ -45,6 +45,10 @@ void main_1() { break; } /* fallthrough */ + { + i = (i - 3); + } + break; } default: { i = (i - 3); @@ -72,6 +76,5 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x00000259291CFD70(11,5): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x00000259291CFD70(26,13-21): error X3708: continue cannot be used in a switch +O:\src\chrome\src\third_party\dawn\third_party\tint\test\Shader@0x0000028C1CDAABD0(26,13-21): error X3708: continue cannot be used in a switch diff --git a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl index 17e7f25316..5f8be8e238 100644 --- a/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/switch-loop-switch-if/0-opt.wgsl.expected.hlsl @@ -45,6 +45,10 @@ void main_1() { break; } /* fallthrough */ + { + i = (i - 3); + } + break; } default: { i = (i - 3); @@ -72,6 +76,5 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x000001E28E944DC0(11,5): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000001E28E944DC0(26,13-21): error X3708: continue cannot be used in a switch +O:\src\chrome\src\third_party\dawn\third_party\tint\test\Shader@0x0000015D2C356900(26,13-21): error X3708: continue cannot be used in a switch diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl index 70d1d9c5af..2e3da9b13d 100644 --- a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.spvasm.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; }; @@ -31,15 +29,48 @@ void main_1() { y = x_54; x_55_phi = x_54; /* fallthrough */ + { + const float x_47 = clamp(1.0f, 0.5f, x_55_phi); + y = x_47; + x_46_phi = x_47; + /* fallthrough */ + } + { + /* fallthrough */ + } + { + if ((x_46_phi == 1.0f)) { + x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + } + break; } case 1: { const float x_47 = clamp(1.0f, 0.5f, x_55_phi); y = x_47; x_46_phi = x_47; /* fallthrough */ + { + /* fallthrough */ + } + { + if ((x_46_phi == 1.0f)) { + x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + } + break; } default: { /* fallthrough */ + { + if ((x_46_phi == 1.0f)) { + x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + } + break; } case 2: { if ((x_46_phi == 1.0f)) { @@ -71,10 +102,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x000002EAE8878270(27,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000002EAE8878270(33,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000002EAE8878270(39,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000002EAE8878270(32,7): error X3537: Fall-throughs in switch statements are not allowed. -C:\src\tint\test\Shader@0x000002EAE8878270(38,7): error X3537: Fall-throughs in switch statements are not allowed. -C:\src\tint\test\Shader@0x000002EAE8878270(41,7): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl index dbcd029479..2e3da9b13d 100644 --- a/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/switch-with-fall-through-cases/0-opt.wgsl.expected.hlsl @@ -1,5 +1,3 @@ -SKIP: FAILED - cbuffer cbuffer_x_6 : register(b0, space0) { uint4 x_6[1]; }; @@ -31,15 +29,48 @@ void main_1() { y = x_54; x_55_phi = x_54; /* fallthrough */ + { + const float x_47 = clamp(1.0f, 0.5f, x_55_phi); + y = x_47; + x_46_phi = x_47; + /* fallthrough */ + } + { + /* fallthrough */ + } + { + if ((x_46_phi == 1.0f)) { + x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + } + break; } case 1: { const float x_47 = clamp(1.0f, 0.5f, x_55_phi); y = x_47; x_46_phi = x_47; /* fallthrough */ + { + /* fallthrough */ + } + { + if ((x_46_phi == 1.0f)) { + x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + } + break; } default: { /* fallthrough */ + { + if ((x_46_phi == 1.0f)) { + x_GLF_color = float4(float((x_31 + 1)), 0.0f, 0.0f, 1.0f); + return; + } + } + break; } case 2: { if ((x_46_phi == 1.0f)) { @@ -71,10 +102,3 @@ tint_symbol main() { const tint_symbol tint_symbol_3 = {tint_symbol_1.x_GLF_color_1}; return tint_symbol_3; } -C:\src\tint\test\Shader@0x000001B3F8915FF0(27,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000001B3F8915FF0(33,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000001B3F8915FF0(39,7): error X3533: non-empty case statements must have break or return -C:\src\tint\test\Shader@0x000001B3F8915FF0(32,7): error X3537: Fall-throughs in switch statements are not allowed. -C:\src\tint\test\Shader@0x000001B3F8915FF0(38,7): error X3537: Fall-throughs in switch statements are not allowed. -C:\src\tint\test\Shader@0x000001B3F8915FF0(41,7): error X3537: Fall-throughs in switch statements are not allowed. - diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl index 49336f598e..e10a3b8cff 100644 --- a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.spvasm.expected.hlsl @@ -25,6 +25,10 @@ void main_1() { while (true) { } /* fallthrough */ + { + data[0] = 2.0f; + } + break; } case 0: { data[0] = 2.0f; diff --git a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl index 49336f598e..e10a3b8cff 100644 --- a/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl +++ b/test/vk-gl-cts/graphicsfuzz/unreachable-loops-in-switch/0.wgsl.expected.hlsl @@ -25,6 +25,10 @@ void main_1() { while (true) { } /* fallthrough */ + { + data[0] = 2.0f; + } + break; } case 0: { data[0] = 2.0f;