-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[HLSL][RootSignature] Add metadata generation for descriptor tables #139633
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
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
135e6c9
pre-req: update attr to store reference to root signature decl
inbelic e1693cc
add basic empty root signature
inbelic 76e3b5e
pass down the actual root elements
inbelic bdbf47c
introduce a MetadataBuilder to handle the construction of nodes
inbelic a931947
add support for DescriptorTableClauses
inbelic 5ccbf46
add support for associating DescriptorTables with their clauses
inbelic 0ed0c09
self-review: misc clean up
inbelic 9e1e530
clang-format
inbelic b613e2e
review: remove use of CHECK-DAG
inbelic 3da3df5
self-review: remove commented header
inbelic be9173c
self-review: use << operator instead of redefining switch behaviour
inbelic dfe18c0
self-review: mark to revisit get_if chain
inbelic 496ab5d
review: clarify the struct the in-memory representation
inbelic 3f5eb15
review: style fixups
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.3-library -emit-llvm -o - %s | FileCheck %s | ||
|
||
// CHECK: !dx.rootsignatures = !{![[#FIRST_ENTRY:]], ![[#SECOND_ENTRY:]]} | ||
|
||
// CHECK: ![[#FIRST_ENTRY]] = !{ptr @FirstEntry, ![[#EMPTY:]]} | ||
// CHECK: ![[#EMPTY]] = !{} | ||
|
||
[shader("compute"), RootSignature("")] | ||
[numthreads(1,1,1)] | ||
void FirstEntry() {} | ||
|
||
// CHECK: ![[#SECOND_ENTRY]] = !{ptr @SecondEntry, ![[#SECOND_RS:]]} | ||
// CHECK: ![[#SECOND_RS]] = !{![[#TABLE:]]} | ||
// CHECK: ![[#TABLE]] = !{!"DescriptorTable", i32 0, ![[#CBV:]], ![[#SRV:]]} | ||
// CHECK: ![[#CBV]] = !{!"CBV", i32 1, i32 0, i32 0, i32 -1, i32 4} | ||
// CHECK: ![[#SRV]] = !{!"SRV", i32 4, i32 42, i32 3, i32 32, i32 0} | ||
|
||
#define SampleDescriptorTable \ | ||
"DescriptorTable( " \ | ||
" CBV(b0), " \ | ||
" SRV(t42, space = 3, offset = 32, numDescriptors = 4, flags = 0) " \ | ||
")" | ||
[shader("compute"), RootSignature(SampleDescriptorTable)] | ||
[numthreads(1,1,1)] | ||
void SecondEntry() {} | ||
|
||
// Sanity test to ensure no root is added for this function as there is only | ||
// two entries in !dx.roosignatures | ||
[shader("compute")] | ||
[numthreads(1,1,1)] | ||
void ThirdEntry() {} |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if that assert would really help, since it could easily be mislead by the generation of other parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added as a (hopefully) better error message rather than the error that would be generated if
Generated.size() - Table.NumClauses
created an undefined behaviour iterator.Do you have a suggestion for how it could be better worded, or, a better assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how complex/useful this is, we could check how many
DescriptorTableClause
are inTableOperands
preceding the table. I think this could be done like:Not sure this code is correct/useful, but that is the idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea and toyed around with it a bit. It unfortunately is a bit a unwieldly to implement. I think it introduces more complexity then it reduces