-
Notifications
You must be signed in to change notification settings - Fork 886
Fix 8601 check for RayQuery user type #8610
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
Open
Brendan Duncan (brendan-duncan)
wants to merge
4
commits into
microsoft:main
Choose a base branch
from
brendan-duncan:fix-8601-rayquery-shadow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+76
−15
Open
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b98d915
fix 8601 check for RayQuery user type
brendan-duncan 85ff36f
Update tools/clang/lib/SPIRV/AstTypeProbe.cpp
brendan-duncan 99f140c
Update tools/clang/lib/SPIRV/LowerTypeVisitor.cpp
brendan-duncan ee0b0e2
fix IsHLSLRayQueryType string check; add test
brendan-duncan 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
35 changes: 35 additions & 0 deletions
35
tools/clang/test/CodeGenSPIRV/type.rayquery.user-defined-shadow.hlsl
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,35 @@ | ||
| // RUN: %dxc -T cs_6_6 -E MainRayGenShader -fcgl -spirv %s | FileCheck %s | ||
|
brendan-duncan marked this conversation as resolved.
Outdated
|
||
|
|
||
| // A user-defined struct named "RayQuery" that shadows the reserved intrinsic | ||
| // name must be lowered as an ordinary struct, not as the opaque ray query | ||
| // type. Previously this crashed the SPIR-V backend. | ||
| // See https://github.com/microsoft/DirectXShaderCompiler/issues/8601 | ||
|
|
||
| namespace UnifiedRT { | ||
| struct RayQuery { | ||
| float4 foo; | ||
| }; | ||
| } // namespace UnifiedRT | ||
|
|
||
| // The shadowing struct is lowered to an ordinary struct with a float4 field, | ||
| // and the local variable uses that struct type in the Function storage class. | ||
| // CHECK: %RayQuery = OpTypeStruct %v4float | ||
| // CHECK: %_ptr_Function_RayQuery = OpTypePointer Function %RayQuery | ||
| // CHECK: %rayQuery = OpVariable %_ptr_Function_RayQuery Function | ||
|
|
||
| // It must not be lowered to the opaque ray query type. | ||
| // CHECK-NOT: OpTypeRayQueryKHR | ||
|
|
||
| StructuredBuffer<uint> _UnifiedRT_DispatchDims; | ||
|
|
||
| [numthreads(128, 1, 1)] | ||
| void MainRayGenShader(in uint3 gidx : SV_DispatchThreadID, | ||
| in uint lidx : SV_GroupIndex) { | ||
| if (gidx.x >= _UnifiedRT_DispatchDims[0] || | ||
| gidx.y >= _UnifiedRT_DispatchDims[1] || | ||
| gidx.z >= _UnifiedRT_DispatchDims[2]) | ||
| return; | ||
|
|
||
| UnifiedRT::RayQuery rayQuery; | ||
| rayQuery.foo = float4(1.0, 1.0, 1.0, 1.0); | ||
| } | ||
Oops, something went wrong.
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.