[llvm] [DXIL] Adding support to RootSignatureFlags in obj2yaml (PR #122396)
Justin Bogner via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 3 22:51:14 PST 2025
================
@@ -821,3 +821,25 @@ TEST(DXCFile, MalformedSignature) {
"the end of the part data"));
}
}
+
+TEST(RootSignature, ParseRootFlags) {
+ uint8_t Buffer[] = {
+ 0x44, 0x58, 0x42, 0x43, 0x32, 0x9A, 0x53, 0xD8, 0xEC, 0xBE, 0x35, 0x6F,
+ 0x05, 0x39, 0xE1, 0xFE, 0x31, 0x20, 0xF0, 0xC1, 0x01, 0x00, 0x00, 0x00,
+ 0x44, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00,
+ 0x52, 0x54, 0x53, 0x30, 0x18, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
+ };
+ DXContainer C =
+ llvm::cantFail(DXContainer::create(getMemoryBuffer<180>(Buffer)));
+
+ const auto &RS = C.getRootSignature();
+ ASSERT_TRUE(RS.has_value());
+ ASSERT_EQ(RS->getVersion(), 2);
+ ASSERT_EQ(RS->getNumParameters(), 0);
+ ASSERT_EQ(RS->getRootParametersOffset(), 0);
+ ASSERT_EQ(RS->getNumStaticSamplers(), 0);
+ ASSERT_EQ(RS->getStaticSamplersOffset(), 0);
+ ASSERT_EQ(RS->getFlags(), 0x01);
----------------
bogner wrote:
Similar to Damyan's suggestion above, we should really use non-zero values for the fields here to ensure that we're reading things from the right places. As is, if we changed the order of the fields in the parser arbitrarily this test would still pass, which is not great.
https://github.com/llvm/llvm-project/pull/122396
More information about the llvm-commits
mailing list