Skip to content

Commit da9207b

Browse files
committed
DXIL ControlFlow Unit Test for specific loop construction
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
1 parent 06cf587 commit da9207b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

renderdoc/driver/shaders/dxil/dxil_controlflow.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -896,6 +896,29 @@ TEST_CASE("DXIL Control Flow", "[dxil]")
896896
REQUIRE(loopBlocks.contains(12U));
897897
REQUIRE(loopBlocks.contains(68U));
898898
}
899+
{
900+
// Specific loop case where a block (2) in a loop is only in a single path
901+
// 0 -> 1 -> 3 - 1
902+
// 0 -> 1 -> 2 -> 3
903+
// 3 -> 4 -> END
904+
rdcarray<BlockLink> inputs;
905+
inputs.push_back({0, 1});
906+
inputs.push_back({1, 3});
907+
inputs.push_back({3, 1});
908+
inputs.push_back({1, 2});
909+
inputs.push_back({2, 3});
910+
inputs.push_back({3, 4});
911+
controlFlow.Construct(inputs);
912+
uniformBlocks = controlFlow.GetUniformBlocks();
913+
REQUIRE(2 == uniformBlocks.count());
914+
REQUIRE(uniformBlocks.contains(0U));
915+
REQUIRE(uniformBlocks.contains(4U));
916+
loopBlocks = controlFlow.GetLoopBlocks();
917+
REQUIRE(3 == loopBlocks.count());
918+
REQUIRE(loopBlocks.contains(1U));
919+
REQUIRE(loopBlocks.contains(2U));
920+
REQUIRE(loopBlocks.contains(3U));
921+
}
899922
};
900923
};
901924
#endif // ENABLED(ENABLE_UNIT_TESTS)

0 commit comments

Comments
 (0)