-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[HLSL] Define the HLSLRootSignature Attr #123985
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
Closed
inbelic
wants to merge
9
commits into
llvm:users/inbelic/pr-122982
from
inbelic:inbelic/rootsig-attr
Closed
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
d9b0d8e
[HLSL] Define the HLSLRootSignature Attr
inbelic 340a97f
add docs
inbelic 68cc33b
rebase onto updated lex/parser prs
inbelic bc9f4b4
add some additional error testing
inbelic 007fc5b
review comments:
inbelic c0e5fe1
rebase changes
inbelic bde15d0
rebase onto parser review changes
inbelic 1abd7ac
review: add wrong number of arguments diagnostic
inbelic 4180ab7
review: track update to adding float support issue
inbelic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-library -ast-dump \ | ||
// RUN: -disable-llvm-passes -o - %s | FileCheck %s | ||
|
||
// This test ensures that the sample root signature is parsed without error and | ||
// the Attr AST Node is created succesfully. If an invalid root signature was | ||
// passed in then we would exit out of Sema before the Attr is created. | ||
|
||
#define SampleRS \ | ||
"DescriptorTable( " \ | ||
" CBV(b1), " \ | ||
" SRV(t1, numDescriptors = 8, " \ | ||
" flags = DESCRIPTORS_VOLATILE), " \ | ||
" UAV(u1, numDescriptors = 0, " \ | ||
" flags = DESCRIPTORS_VOLATILE) " \ | ||
"), " \ | ||
"DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))" | ||
|
||
// CHECK: HLSLRootSignatureAttr | ||
// CHECK-SAME: "DescriptorTable( | ||
// CHECK-SAME: CBV(b1), | ||
// CHECK-SAME: SRV(t1, numDescriptors = 8, | ||
// CHECK-SAME: flags = DESCRIPTORS_VOLATILE), | ||
// CHECK-SAME: UAV(u1, numDescriptors = 0, | ||
// CHECK-SAME: flags = DESCRIPTORS_VOLATILE) | ||
// CHECK-SAME: ), | ||
// CHECK-SAME: DescriptorTable(Sampler(s0, numDescriptors = 4, space = 1))" | ||
[RootSignature(SampleRS)] | ||
void main() {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -x hlsl -o - %s -verify | ||
|
||
// This file mirrors the diagnostics testing in ParseHLSLRootSignatureTest.cpp | ||
// to verify that the correct diagnostics strings are output | ||
|
||
// Attr test | ||
|
||
[RootSignature()] // expected-error {{'RootSignature' attribute takes one argument}} | ||
void bad_root_signature_0() {} | ||
|
||
// Lexer related tests | ||
|
||
#define InvalidToken \ | ||
"DescriptorTable( " \ | ||
" invalid " \ | ||
")" | ||
|
||
[RootSignature(InvalidToken)] // expected-error {{expected one of the following token kinds: CBV, SRV, UAV, Sampler}} | ||
void bad_root_signature_1() {} | ||
|
||
#define InvalidEmptyNumber \ | ||
"DescriptorTable( " \ | ||
" CBV(t32, space = +) " \ | ||
")" | ||
|
||
// expected-error@+1 {{expected the following token kind: integer literal}} | ||
[RootSignature(InvalidEmptyNumber)] | ||
void bad_root_signature_2() {} | ||
|
||
#define InvalidOverflowNumber \ | ||
"DescriptorTable( " \ | ||
" CBV(t32, space = 98273498327498273487) " \ | ||
")" | ||
|
||
// expected-error@+1 {{integer literal '98273498327498273487' is too large to be represented in a 32-bit integer type}} | ||
[RootSignature(InvalidOverflowNumber)] | ||
void bad_root_signature_3() {} | ||
|
||
// Parser related tests | ||
|
||
#define InvalidEOS \ | ||
"DescriptorTable( " \ | ||
" CBV(" | ||
|
||
[RootSignature(InvalidEOS)] // expected-error {{expected one of the following token kinds: b register, t register, u register, s register}} | ||
void bad_root_signature_4() {} | ||
|
||
#define InvalidTokenKind \ | ||
"DescriptorTable( " \ | ||
" SRV(s0, CBV())" \ | ||
")" | ||
|
||
[RootSignature(InvalidTokenKind)] // expected-error {{expected one of the following token kinds: offset, numDescriptors, space, flags}} | ||
void bad_root_signature_5() {} | ||
|
||
#define InvalidRepeat \ | ||
"DescriptorTable( " \ | ||
" CBV(t0, space = 1, space = 2)" \ | ||
")" | ||
|
||
[RootSignature(InvalidRepeat)] // expected-error {{specified the same parameter 'space' multiple times}} | ||
void bad_root_signature_6() {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.