-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[spirv] Fix null pointer dereference
Fix a null pointer dereference which can occur when an unimplemented intrinsic is used. The repro shader from issue #2955 (added as a unit test) now fails with a useful message rather than a silent crash.
- Loading branch information
1 parent
6ec0157
commit 3bde32e
Showing
3 changed files
with
31 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
25 changes: 25 additions & 0 deletions
25
tools/clang/test/CodeGenSPIRV/intrinsics.get-attribute-at-vertex.hlsl
This file contains 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,25 @@ | ||
// Run: %dxc -T ps_6_1 -E main | ||
|
||
struct PSInput { | ||
float4 position : SV_POSITION; | ||
nointerpolation float3 color : COLOR; | ||
}; | ||
|
||
cbuffer constants : register(b0) { | ||
float4 g_constants; | ||
} | ||
|
||
float4 main(PSInput input) : SV_TARGET { | ||
uint cmp = (uint)(g_constants[0]); | ||
|
||
// CHECK: 16:21: error: GetAttributeAtVertex intrinsic function unimplemented | ||
float colorAtV0 = GetAttributeAtVertex(input.color, 0)[cmp]; | ||
|
||
// CHECK: 19:21: error: GetAttributeAtVertex intrinsic function unimplemented | ||
float colorAtV1 = GetAttributeAtVertex(input.color, 1)[cmp]; | ||
|
||
// CHECK: 22:21: error: GetAttributeAtVertex intrinsic function unimplemented | ||
float colorAtV2 = GetAttributeAtVertex(input.color, 2)[cmp]; | ||
|
||
return float4(colorAtV0, colorAtV1, colorAtV2, 0); | ||
} |
This file contains 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