@@ -255,7 +255,9 @@ TEST_F(ParseHLSLRootSignatureTest, ValidSamplerFlagsTest) {
255
255
TEST_F (ParseHLSLRootSignatureTest, ValidParseRootConsantsTest) {
256
256
const llvm::StringLiteral Source = R"cc(
257
257
RootConstants(num32BitConstants = 1, b0),
258
- RootConstants(b42, num32BitConstants = 4294967295)
258
+ RootConstants(b42, space = 3, num32BitConstants = 4294967295,
259
+ visibility = SHADER_VISIBILITY_HULL
260
+ )
259
261
)cc" ;
260
262
261
263
TrivialModuleLoader ModLoader;
@@ -278,12 +280,16 @@ TEST_F(ParseHLSLRootSignatureTest, ValidParseRootConsantsTest) {
278
280
ASSERT_EQ (std::get<RootConstants>(Elem).Num32BitConstants , 1u );
279
281
ASSERT_EQ (std::get<RootConstants>(Elem).Reg .ViewType , RegisterType::BReg);
280
282
ASSERT_EQ (std::get<RootConstants>(Elem).Reg .Number , 0u );
283
+ ASSERT_EQ (std::get<RootConstants>(Elem).Space , 0u );
284
+ ASSERT_EQ (std::get<RootConstants>(Elem).Visibility , ShaderVisibility::All);
281
285
282
286
Elem = Elements[1 ];
283
287
ASSERT_TRUE (std::holds_alternative<RootConstants>(Elem));
284
288
ASSERT_EQ (std::get<RootConstants>(Elem).Num32BitConstants , 4294967295u );
285
289
ASSERT_EQ (std::get<RootConstants>(Elem).Reg .ViewType , RegisterType::BReg);
286
290
ASSERT_EQ (std::get<RootConstants>(Elem).Reg .Number , 42u );
291
+ ASSERT_EQ (std::get<RootConstants>(Elem).Space , 3u );
292
+ ASSERT_EQ (std::get<RootConstants>(Elem).Visibility , ShaderVisibility::Hull);
287
293
288
294
ASSERT_TRUE (Consumer->isSatisfied ());
289
295
}
@@ -469,7 +475,7 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidRepeatedMandatoryRCParameterTest) {
469
475
ASSERT_TRUE (Consumer->isSatisfied ());
470
476
}
471
477
472
- TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalParameterTest ) {
478
+ TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalDTParameterTest ) {
473
479
// This test will check that the parsing fails due the same optional
474
480
// parameter being specified multiple times
475
481
const llvm::StringLiteral Source = R"cc(
@@ -493,6 +499,32 @@ TEST_F(ParseHLSLRootSignatureTest, InvalidRepeatedOptionalParameterTest) {
493
499
ASSERT_TRUE (Consumer->isSatisfied ());
494
500
}
495
501
502
+ TEST_F (ParseHLSLRootSignatureTest, InvalidRepeatedOptionalRCParameterTest) {
503
+ // This test will check that the parsing fails due the same optional
504
+ // parameter being specified multiple times
505
+ const llvm::StringLiteral Source = R"cc(
506
+ RootConstants(
507
+ visibility = Shader_Visibility_All,
508
+ b0, num32BitConstants = 1,
509
+ visibility = Shader_Visibility_Pixel
510
+ )
511
+ )cc" ;
512
+
513
+ TrivialModuleLoader ModLoader;
514
+ auto PP = createPP (Source, ModLoader);
515
+ auto TokLoc = SourceLocation ();
516
+
517
+ hlsl::RootSignatureLexer Lexer (Source, TokLoc);
518
+ SmallVector<RootElement> Elements;
519
+ hlsl::RootSignatureParser Parser (Elements, Lexer, *PP);
520
+
521
+ // Test correct diagnostic produced
522
+ Consumer->setExpected (diag::err_hlsl_rootsig_repeat_param);
523
+ ASSERT_TRUE (Parser.parse ());
524
+
525
+ ASSERT_TRUE (Consumer->isSatisfied ());
526
+ }
527
+
496
528
TEST_F (ParseHLSLRootSignatureTest, InvalidLexOverflowedNumberTest) {
497
529
// This test will check that the lexing fails due to an integer overflow
498
530
const llvm::StringLiteral Source = R"cc(
0 commit comments