-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[HLSL][RootSignature] Add parsing of Register in params for RootDescriptors #140148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -346,9 +346,9 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseRootFlagsTest) { | |
|
||
TEST_F(ParseHLSLRootSignatureTest, ValidParseRootDescriptorsTest) { | ||
const llvm::StringLiteral Source = R"cc( | ||
CBV(), | ||
SRV(), | ||
UAV() | ||
Comment on lines
-349
to
-351
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we have a test somewhere that we error/reject empty for these now that the required parameters are wired up? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are the |
||
CBV(b0), | ||
SRV(t42), | ||
UAV(u34893247) | ||
)cc"; | ||
|
||
TrivialModuleLoader ModLoader; | ||
|
@@ -369,14 +369,20 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseRootDescriptorsTest) { | |
RootElement Elem = Elements[0]; | ||
ASSERT_TRUE(std::holds_alternative<RootDescriptor>(Elem)); | ||
ASSERT_EQ(std::get<RootDescriptor>(Elem).Type, DescriptorType::CBuffer); | ||
ASSERT_EQ(std::get<RootDescriptor>(Elem).Reg.ViewType, RegisterType::BReg); | ||
ASSERT_EQ(std::get<RootDescriptor>(Elem).Reg.Number, 0u); | ||
|
||
Elem = Elements[1]; | ||
ASSERT_TRUE(std::holds_alternative<RootDescriptor>(Elem)); | ||
ASSERT_EQ(std::get<RootDescriptor>(Elem).Type, DescriptorType::SRV); | ||
ASSERT_EQ(std::get<RootDescriptor>(Elem).Reg.ViewType, RegisterType::TReg); | ||
ASSERT_EQ(std::get<RootDescriptor>(Elem).Reg.Number, 42u); | ||
|
||
Elem = Elements[2]; | ||
ASSERT_TRUE(std::holds_alternative<RootDescriptor>(Elem)); | ||
ASSERT_EQ(std::get<RootDescriptor>(Elem).Type, DescriptorType::UAV); | ||
ASSERT_EQ(std::get<RootDescriptor>(Elem).Reg.ViewType, RegisterType::UReg); | ||
ASSERT_EQ(std::get<RootDescriptor>(Elem).Reg.Number, 34893247u); | ||
|
||
ASSERT_TRUE(Consumer->isSatisfied()); | ||
} | ||
|
@@ -494,6 +500,28 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidMissingDTParameterTest) { | |
ASSERT_TRUE(Consumer->isSatisfied()); | ||
} | ||
|
||
TEST_F(ParseHLSLRootSignatureTest, InvalidMissingRDParameterTest) { | ||
// This test will check that the parsing fails due a mandatory | ||
// parameter (register) not being specified | ||
const llvm::StringLiteral Source = R"cc( | ||
SRV() | ||
)cc"; | ||
|
||
TrivialModuleLoader ModLoader; | ||
auto PP = createPP(Source, ModLoader); | ||
auto TokLoc = SourceLocation(); | ||
|
||
hlsl::RootSignatureLexer Lexer(Source, TokLoc); | ||
SmallVector<RootElement> Elements; | ||
hlsl::RootSignatureParser Parser(Elements, Lexer, *PP); | ||
|
||
// Test correct diagnostic produced | ||
Consumer->setExpected(diag::err_hlsl_rootsig_missing_param); | ||
ASSERT_TRUE(Parser.parse()); | ||
|
||
ASSERT_TRUE(Consumer->isSatisfied()); | ||
} | ||
|
||
TEST_F(ParseHLSLRootSignatureTest, InvalidMissingRCParameterTest) { | ||
// This test will check that the parsing fails due a mandatory | ||
// parameter (num32BitConstants) not being specified | ||
|
Uh oh!
There was an error while loading. Please reload this page.