Commit ed2a3387 by Ben Clayton

VulkanUnitTests: Fix SPIR-V validation issue

`LoopDivergentMergePhi` was attempting to use the same merge block for a `OpLoopMerge` and a `OpSelectionMerge`. This is not legal, and was caught by improvements to the SPIR-V tools validator. The fix is simple: Add a new merge block for the inner `OpSelectionMerge` that immediately jumps to the merge block for the `OpLoopMerge`. Bug: b/123642959 Bug: b/133440380 Bug: b/133481698 Change-Id: I8b5da04a1cd2db3e44bb5b50f1619a8565e5bc9d
parent e0081569
......@@ -1564,19 +1564,21 @@ TEST_P(SwiftShaderVulkanBufferToBufferComputeTest, LoopDivergentMergePhi)
"OpBranchConditional %33 %35 %34\n"
"%35 = OpLabel\n"
"%36 = OpIEqual %20 %28 %30\n"
"OpSelectionMerge %32 None\n"
"OpBranchConditional %36 %37 %32\n"
"%37 = OpLabel\n"
"%38 = OpAccessChain %22 %6 %13 %27\n"
"%39 = OpLoad %12 %38\n"
"OpSelectionMerge %37 None\n"
"OpBranchConditional %36 %38 %37\n"
"%38 = OpLabel\n"
"%39 = OpAccessChain %22 %6 %13 %27\n"
"%40 = OpLoad %12 %39\n"
"OpBranch %34\n"
"%37 = OpLabel\n"
"OpBranch %32\n"
"%32 = OpLabel\n"
"%31 = OpIAdd %14 %30 %23\n"
"OpBranch %29\n"
"%34 = OpLabel\n"
"%40 = OpPhi %12 %13 %29 %39 %37\n" // %39: phi
"%41 = OpAccessChain %22 %9 %13 %27\n"
"OpStore %41 %40\n"
"%41 = OpPhi %12 %13 %29 %40 %38\n" // %40: phi
"%42 = OpAccessChain %22 %9 %13 %27\n"
"OpStore %42 %41\n"
"OpReturn\n"
"OpFunctionEnd\n";
test(src.str(), [](uint32_t i) { return i; }, [](uint32_t i) { return i; });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment