Skip to content

Commit

Permalink
DXIL ControlFlow Unit Test for specific loop construction
Browse files Browse the repository at this point in the history
A loop where a block (2) in a loop is only in a single path
0 -> 1 -> 3 - 1
0 -> 1 -> 2 -> 3
3 -> 4 -> END
  • Loading branch information
Zorro666 committed Dec 30, 2024
1 parent 06cf587 commit da9207b
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions renderdoc/driver/shaders/dxil/dxil_controlflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,29 @@ TEST_CASE("DXIL Control Flow", "[dxil]")
REQUIRE(loopBlocks.contains(12U));
REQUIRE(loopBlocks.contains(68U));
}
{
// Specific loop case where a block (2) in a loop is only in a single path
// 0 -> 1 -> 3 - 1
// 0 -> 1 -> 2 -> 3
// 3 -> 4 -> END
rdcarray<BlockLink> inputs;
inputs.push_back({0, 1});
inputs.push_back({1, 3});
inputs.push_back({3, 1});
inputs.push_back({1, 2});
inputs.push_back({2, 3});
inputs.push_back({3, 4});
controlFlow.Construct(inputs);
uniformBlocks = controlFlow.GetUniformBlocks();
REQUIRE(2 == uniformBlocks.count());
REQUIRE(uniformBlocks.contains(0U));
REQUIRE(uniformBlocks.contains(4U));
loopBlocks = controlFlow.GetLoopBlocks();
REQUIRE(3 == loopBlocks.count());
REQUIRE(loopBlocks.contains(1U));
REQUIRE(loopBlocks.contains(2U));
REQUIRE(loopBlocks.contains(3U));
}
};
};
#endif // ENABLED(ENABLE_UNIT_TESTS)

0 comments on commit da9207b

Please sign in to comment.