-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[DirectX] Validate if Textures/TypedBuffers are being bound in Root Signatures #147573
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
joaosaffran
merged 130 commits into
llvm:main
from
joaosaffran:validation/textures-not-bind-root-signatures
Sep 10, 2025
Merged
Changes from all commits
Commits
Show all changes
130 commits
Select commit
Hold shift + click to select a range
0e8828c
refactoring
2edd215
refactoring
242545e
clean up
3f8dec4
format
3b1ce3b
formating
f5720af
fix import issues
ea54904
formating
a49aa19
refactoring
d90676f
init refactoring
a04eb9f
adding validation
5994b8f
clean
e8b14bf
implementing
8f40e83
finish implementing && fix tests
28350b2
fix issue
4fd2e0b
sync parent
e25ee87
sync parent
01a558b
add validation
881dd36
address comments
8779ee9
Merge branch 'refactoring/updating-return-root-sig-analysis' into val…
43eb04e
adding validation
c16f15b
fix test
f67bec1
Merge branch 'validation/check-descriptors-are-bound' into validation…
d7b4cf4
format
c7d5be7
format
cc5afae
address changes
571a0ef
fix tests
974d4bc
Merge branch 'refactoring/updating-return-root-sig-analysis' into val…
403b546
Merge branch 'validation/check-descriptors-are-bound' into validation…
aea75da
fix test
e0bc862
add preserved
b5a0b32
addressing comments
00a74af
Merge branch 'main' into validation/check-descriptors-are-bound
5ccb842
updating
5423aba
format
a7637a7
adding tests
da42c0c
clean up
5af9199
update
46294cb
Merge branch 'validation/check-descriptors-are-bound' into validation…
91ff1bf
clean up
edb015d
address comments
5f8bbeb
Merge branch 'validation/check-descriptors-are-bound' into validation…
9f3888e
adding root constants
8459d14
Merge branch 'validation/check-descriptors-are-bound' into validation…
578a03b
clean
34deb3a
Merge branch 'validation/check-descriptors-are-bound' into validation…
b4a0e16
moving code arround
49f3bf2
Merge branch 'validation/check-descriptors-are-bound' into validation…
ef14638
clean
662c3a8
addressing comments
848501d
address comments
8d97116
format test
9c34f3f
fix test
24040a0
Merge branch 'validation/check-descriptors-are-bound' into validation…
2c30cd9
addressing comments
260633c
address comments
d42f156
Merge branch 'main' into validation/check-descriptors-are-bound
9ee3a4b
Merge branch 'main' into validation/check-descriptors-are-bound
6db6224
update code
04658b8
cleanup
adf3feb
address comments from inbelic
c95ce68
refactoring
af6aa53
add tests
29eb893
cleanup
ed4c553
clean
28fb609
clean up
fc338b5
Merge branch 'validation/overlapping-ranges' into validation/check-de…
f5b5b3e
clean
03d571a
clean?
76048d4
Merge branch 'validation/check-descriptors-are-bound' into validation…
7c9bd62
clean?
ef51048
format
21675e6
formating
849ff86
format
7a1bc21
format
403972d
addressing comments from bogner and inbelic
joaosaffran-zz 0f0435d
clean up
joaosaffran-zz e841a98
clean up
joaosaffran-zz ae6d67a
fix build
joaosaffran-zz 41f32bd
fix tests
joaosaffran-zz 47662f0
Merge branch 'validation/overlapping-ranges' into validation/check-de…
6da5fb0
format
108a7d5
Merge branch 'validation/check-descriptors-are-bound' into validation…
6f3d019
Merge branch 'main' into validation/overlapping-ranges
971ad57
Merge branch 'main' into validation/overlapping-ranges
db73d71
update
3b04c2d
address comment from inbelic
1ddffc3
address comments 2
1c10acf
fix merge mess
db0008e
addressing comments from inbelic
0c72dcf
addressing inbelic comments
b4e5fb4
adding test
4a655a5
addressing comments from bogner
cc94561
addressing comments
98f48d2
address comments
eb334b8
refactoring
06c0da4
addressing comments
d58606f
Merge branch 'main' into validation/overlapping-ranges
74980c8
fix test
d376abf
address comments
4abb40d
Merge branch 'validation/overlapping-ranges' into validation/check-de…
bb44eef
fix test
1cf2d1e
Merge branch 'main' into validation/check-descriptors-are-bound
373d871
clean up
d2750d7
format
777d544
Merge branch 'validation/check-descriptors-are-bound' into validation…
19e9baa
fix merge oopsi
708c4dc
format
a163d1b
clean up
4f120cc
clean up tests
7cf513f
format
fe24637
format
6db8d93
refactoring to not create extra space
joaosaffran e3a65b6
remove copy of binding
joaosaffran e902add
making BindingRange const
joaosaffran 9a6d64c
doing it again for other isBound
joaosaffran 15b7592
adding DXILResourceTypeMap
joaosaffran 11b9fb2
updating error messages and tests
joaosaffran 0b8a997
Merge branch 'validation/check-descriptors-are-bound' into validation…
joaosaffran 17b425d
Merge branch 'main' into validation/textures-not-bind-root-signatures
joaosaffran f9c4b9c
refactoring
joaosaffran c7cedb4
adding comment
joaosaffran bf9b30c
refactoring isBound to return the bound reg
joaosaffran 18e4c3d
formating
joaosaffran 3f83308
remove optional from type
joaosaffran 8daa97b
changing small string size
joaosaffran 79f1f48
fixing tests
joaosaffran 3d10d92
removing type from handlefrombinding
joaosaffran f596ad5
Merge branch 'main' into validation/textures-not-bind-root-signatures
joaosaffran 55c2b96
renamig tests
joaosaffran d1c31f1
Merge branch 'validation/textures-not-bind-root-signatures' of https:…
joaosaffran 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
; RUN: opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s | ||
; "This is a valid root signature with a texture/typed buffer resource" | ||
|
||
@TB.str = private unnamed_addr constant [3 x i8] c"TB\00", align 1 | ||
|
||
define void @CSMain() "hlsl.shader"="compute" { | ||
entry: | ||
%TB = tail call target("dx.Texture", <4 x float>, 1, 0, 0, 4) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr nonnull @TB.str) | ||
ret void | ||
} | ||
|
||
!dx.rootsignatures = !{!0} | ||
|
||
!0 = !{ptr @CSMain, !1, i32 2} | ||
!1 = !{!3} | ||
!3 = !{!"DescriptorTable", i32 0, !4} | ||
!4 = !{!"UAV", i32 1, i32 0, i32 0, i32 -1, i32 0} |
17 changes: 17 additions & 0 deletions
17
llvm/test/CodeGen/DirectX/rootsignature-valid-typedbuffer.ll
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,17 @@ | ||
; RUN: opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | ||
; This is a valid root signature with a texture/typed buffer resource | ||
|
||
@TB.str = private unnamed_addr constant [3 x i8] c"TB\00", align 1 | ||
|
||
define void @CSMain() "hlsl.shader"="compute" { | ||
entry: | ||
%TB = tail call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr nonnull @TB.str) | ||
ret void | ||
} | ||
|
||
!dx.rootsignatures = !{!0} | ||
|
||
!0 = !{ptr @CSMain, !1, i32 2} | ||
!1 = !{!3} | ||
!3 = !{!"DescriptorTable", i32 0, !4} | ||
!4 = !{!"UAV", i32 1, i32 0, i32 0, i32 -1, i32 0} |
16 changes: 16 additions & 0 deletions
16
llvm/test/CodeGen/DirectX/rootsignature-validation-textures-fail.ll
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,16 @@ | ||
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s | ||
; CHECK: error: UAV at register 0 and space 0 is bound to a texture or typed buffer. | ||
|
||
@TB.str = private unnamed_addr constant [3 x i8] c"TB\00", align 1 | ||
|
||
define void @CSMain() "hlsl.shader"="compute" { | ||
entry: | ||
%TB = tail call target("dx.Texture", float, 1, 0, 0, 4) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr nonnull @TB.str) | ||
ret void | ||
} | ||
|
||
!dx.rootsignatures = !{!0} | ||
|
||
!0 = !{ptr @CSMain, !1, i32 2} | ||
!1 = !{!2} | ||
!2 = !{!"RootUAV", i32 0, i32 0, i32 0, i32 4} |
16 changes: 16 additions & 0 deletions
16
llvm/test/CodeGen/DirectX/rootsignature-validation-typedbuffer-fail.ll
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,16 @@ | ||
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s | ||
; CHECK: error: UAV at register 0 and space 0 is bound to a texture or typed buffer. | ||
|
||
@TB.str = private unnamed_addr constant [3 x i8] c"TB\00", align 1 | ||
|
||
define void @CSMain() "hlsl.shader"="compute" { | ||
entry: | ||
%TB = tail call target("dx.TypedBuffer", float, 1, 0, 0) @llvm.dx.resource.handlefrombinding(i32 0, i32 0, i32 1, i32 0, ptr nonnull @TB.str) | ||
ret void | ||
} | ||
|
||
!dx.rootsignatures = !{!0} | ||
|
||
!0 = !{ptr @CSMain, !1, i32 2} | ||
!1 = !{!2} | ||
!2 = !{!"RootUAV", i32 0, i32 0, i32 0, i32 4} |
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.
Last sentence added to match DXC diagnostic message