-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[DirectX] Adding missing descriptor table validations #153276
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 169 commits
0e8828c
2edd215
242545e
3f8dec4
3b1ce3b
f5720af
ea54904
a49aa19
d90676f
a04eb9f
5994b8f
e8b14bf
8f40e83
28350b2
4fd2e0b
e25ee87
01a558b
881dd36
8779ee9
43eb04e
c16f15b
f67bec1
d7b4cf4
c7d5be7
cc5afae
571a0ef
974d4bc
403b546
aea75da
e0bc862
b5a0b32
00a74af
5ccb842
5423aba
a7637a7
da42c0c
5af9199
46294cb
91ff1bf
edb015d
5f8bbeb
9f3888e
8459d14
578a03b
34deb3a
b4a0e16
49f3bf2
ef14638
662c3a8
848501d
8d97116
9c34f3f
24040a0
2c30cd9
260633c
d42f156
9ee3a4b
6db6224
04658b8
adf3feb
c95ce68
af6aa53
29eb893
ed4c553
28fb609
fc338b5
f5b5b3e
03d571a
76048d4
7c9bd62
ef51048
21675e6
849ff86
7a1bc21
403972d
0f0435d
e841a98
ae6d67a
41f32bd
47662f0
6da5fb0
108a7d5
6f3d019
971ad57
db73d71
3b04c2d
1ddffc3
1c10acf
50e78d2
aee4c56
7d1c13e
85719af
cc304fd
3c28142
81261ff
db0008e
0c72dcf
b4e5fb4
e5e73fe
ad0e1f3
d97eb7c
8a4ee3c
4a655a5
cc94561
98f48d2
eb334b8
06c0da4
d58606f
74980c8
23537b5
d376abf
4abb40d
bb44eef
1cf2d1e
373d871
d2750d7
777d544
19e9baa
708c4dc
a163d1b
4f120cc
def929f
d3349ce
bf5714d
7cf513f
fe24637
6db8d93
e3a65b6
e902add
9a6d64c
15b7592
11b9fb2
0b8a997
34619da
84d4579
d2b4aea
e2ba167
b395a47
17b425d
f9c4b9c
c7cedb4
bf9b30c
18e4c3d
567bd15
42518b2
f6abbf7
2971f5f
f0ed242
a6a9fe9
3f83308
8daa97b
79f1f48
3d10d92
f596ad5
55c2b96
d1c31f1
75d74ed
fbf6776
5f429d2
5633433
ec10db8
b42630a
bce1ef9
cf84fcf
e5976ee
eb84e14
6a3c2ab
1327b74
c2d39ed
592dc62
f3253ed
d442625
f785d25
eefd22c
0c508d8
b188df1
dabb9cd
0e08cea
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 |
---|---|---|
|
@@ -48,6 +48,93 @@ class RootSignatureValidationError | |
} | ||
}; | ||
|
||
class OffsetOverflowError : public ErrorInfo<OffsetOverflowError> { | ||
|
||
public: | ||
static char ID; | ||
dxil::ResourceClass Type; | ||
uint32_t Register; | ||
uint32_t Space; | ||
|
||
OffsetOverflowError(dxil::ResourceClass Type, uint32_t Register, | ||
uint32_t Space) | ||
: Type(Type), Register(Register), Space(Space) {} | ||
|
||
void log(raw_ostream &OS) const override { | ||
OS << "Cannot append range with implicit lower bound after an unbounded " | ||
"range " | ||
<< getResourceClassName(Type) << "(register=" << Register | ||
<< ", space=" << Space << ")."; | ||
} | ||
|
||
std::error_code convertToErrorCode() const override { | ||
return llvm::inconvertibleErrorCode(); | ||
} | ||
}; | ||
|
||
class ShaderRegisterOverflowError | ||
: public ErrorInfo<ShaderRegisterOverflowError> { | ||
public: | ||
static char ID; | ||
dxil::ResourceClass Type; | ||
uint32_t Register; | ||
uint32_t Space; | ||
|
||
ShaderRegisterOverflowError(dxil::ResourceClass Type, uint32_t Register, | ||
uint32_t Space) | ||
: Type(Type), Register(Register), Space(Space) {} | ||
|
||
void log(raw_ostream &OS) const override { | ||
OS << "Overflow for shader register range: " << getResourceClassName(Type) | ||
<< "(register=" << Register << ", space=" << Space << ")."; | ||
} | ||
|
||
std::error_code convertToErrorCode() const override { | ||
return llvm::inconvertibleErrorCode(); | ||
} | ||
}; | ||
|
||
class DescriptorRangeOverflowError | ||
: public ErrorInfo<DescriptorRangeOverflowError> { | ||
public: | ||
static char ID; | ||
dxil::ResourceClass Type; | ||
uint32_t Register; | ||
uint32_t Space; | ||
|
||
DescriptorRangeOverflowError(dxil::ResourceClass Type, uint32_t Register, | ||
uint32_t Space) | ||
: Type(Type), Register(Register), Space(Space) {} | ||
|
||
void log(raw_ostream &OS) const override { | ||
OS << "Overflow for descriptor range: " << getResourceClassName(Type) | ||
<< "(register=" << Register << ", space=" << Space << ")."; | ||
} | ||
|
||
std::error_code convertToErrorCode() const override { | ||
return llvm::inconvertibleErrorCode(); | ||
} | ||
}; | ||
|
||
class TableSamplerMixinError : public ErrorInfo<TableSamplerMixinError> { | ||
public: | ||
static char ID; | ||
dxil::ResourceClass Type; | ||
uint32_t Location; | ||
|
||
TableSamplerMixinError(dxil::ResourceClass Type, uint32_t Location) | ||
: Type(Type), Location(Location) {} | ||
|
||
void log(raw_ostream &OS) const override { | ||
OS << "Samplers cannot be mixed with other " | ||
<< "resource types in a descriptor table, " << getResourceClassName(Type) | ||
<< "(location=" << Location << ")"; | ||
} | ||
|
||
std::error_code convertToErrorCode() const override { | ||
return llvm::inconvertibleErrorCode(); | ||
} | ||
}; | ||
|
||
class GenericRSMetadataError : public ErrorInfo<GenericRSMetadataError> { | ||
public: | ||
LLVM_ABI static char ID; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,6 +41,8 @@ LLVM_ABI bool verifyLOD(float LOD); | |
LLVM_ABI bool verifyBoundOffset(uint32_t Offset); | ||
LLVM_ABI bool verifyNoOverflowedOffset(uint64_t Offset); | ||
LLVM_ABI uint64_t computeRangeBound(uint32_t Offset, uint32_t Size); | ||
LLVM_ABI uint64_t updateOngoingOffset(uint64_t CurOffset, | ||
uint64_t NumDescriptors, uint64_t Offset); | ||
|
||
|
||
} // namespace rootsig | ||
} // namespace hlsl | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,17 @@ | ||||||
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s | ||||||
; This test check if a resource is implicitly overflowing. That means, it is appending a resource after an unbounded range. | ||||||
|
; This test check if a resource is implicitly overflowing. That means, it is appending a resource after an unbounded range. | |
; This test checks if a resource is implicitly overflowing. That means, it is appending a resource after an unbounded range. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s | ||
; CHECK: error: Overflow for descriptor range: UAV(register=0, space=0) | ||
|
||
define void @CSMain() "hlsl.shader"="compute" { | ||
entry: | ||
ret void | ||
} | ||
|
||
!dx.rootsignatures = !{!0} | ||
|
||
!0 = !{ptr @CSMain, !1, i32 2} | ||
!1 = !{!3} | ||
!3 = !{!"DescriptorTable", i32 0, !4, !5} | ||
!4 = !{!"UAV", i32 100, i32 0, i32 0, i32 4294967294, i32 0} | ||
!5 = !{!"UAV", i32 1, i32 101, i32 0, i32 10, i32 0} |
inbelic marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
; RUN: not opt -S -passes='dxil-post-optimization-validation' -mtriple=dxil-pc-shadermodel6.6-compute %s 2>&1 | FileCheck %s | ||
; CHECK: error: Overflow for shader register range: UAV(register=4294967295, space=0) | ||
define void @CSMain() "hlsl.shader"="compute" { | ||
entry: | ||
ret void | ||
} | ||
|
||
!dx.rootsignatures = !{!0} | ||
|
||
!0 = !{ptr @CSMain, !1, i32 2} | ||
!1 = !{!3} | ||
!3 = !{!"DescriptorTable", i32 0, !4} | ||
!4 = !{!"UAV", i32 100, i32 4294967295, i32 0, i32 -1, i32 0} |
Uh oh!
There was an error while loading. Please reload this page.