-
Notifications
You must be signed in to change notification settings - Fork 432
Support for Payload Access Qualifiers (#3448) #6595
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
7 commits
Select commit
Hold shift + click to select a range
2506a03
Add support for Ray Payload Access Qualifiers (PAQs) (#3448)
szihs 10a2bde
format code
slangbot ad3e06f
Cleanup: Remove unused vars
szihs 04bf36d
Add check to enablePAQ only for profile >= lib_6_7
szihs 9308e42
Review Fix - Add PAQ support for DX Raytracing
szihs cea9370
Add diagnostic test for missing paq for lib_6_7
szihs 6d38aa5
Merge branch 'master' into feature/paq
expipiplus1 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
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
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
37 changes: 37 additions & 0 deletions
37
tests/diagnostics/raypayload-missing-access-qualifiers.slang
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,37 @@ | ||
| // raypayload-missing-access-qualifiers.slang | ||
|
|
||
| //DIAGNOSTIC_TEST:SIMPLE: | ||
|
|
||
| // Test error for field in ray payload struct missing read/write access qualifiers | ||
|
|
||
| struct [raypayload] RayPayload | ||
| { | ||
| float4 color : read(caller, anyhit) : write(caller); | ||
| float4 colorMissingQualifiers; // Error expected here | ||
|
|
||
| }; | ||
|
|
||
| uniform RWTexture2D<float4> resultTexture; | ||
| uniform RaytracingAccelerationStructure sceneBVH; | ||
|
|
||
| [shader("raygeneration")] | ||
| void rayGenShaderA() | ||
| { | ||
| int2 threadIdx = DispatchRaysIndex().xy; | ||
|
|
||
| float3 rayDir = float3(0, 0, 1); | ||
| float3 rayOrigin = 0; | ||
| rayOrigin.x = (threadIdx.x * 2) - 1; | ||
| rayOrigin.y = (threadIdx.y * 2) - 1; | ||
|
|
||
| // Trace the ray. | ||
| RayDesc ray; | ||
| ray.Origin = rayOrigin; | ||
| ray.Direction = rayDir; | ||
| ray.TMin = 0.001; | ||
| ray.TMax = 10000.0; | ||
| RayPayload payload = { float4(0, 0, 0, 0) , float4(0, 0, 0, 0)}; | ||
| TraceRay(sceneBVH, RAY_FLAG_NONE, ~0, 0, 0, 0, ray, payload); | ||
|
|
||
| resultTexture[threadIdx.xy] = payload.color; | ||
| } |
8 changes: 8 additions & 0 deletions
8
tests/diagnostics/raypayload-missing-access-qualifiers.slang.expected
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,8 @@ | ||
| result code = -1 | ||
| standard error = { | ||
| tests/diagnostics/raypayload-missing-access-qualifiers.slang(10): error 40000: field 'colorMissingQualifiers' in ray payload struct must have either 'read' OR 'write' access qualifiers | ||
| float4 colorMissingQualifiers; // Error expected here | ||
| ^~~~~~~~~~~~~~~~~~~~~~ | ||
| } | ||
| standard output = { | ||
| } |
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,37 @@ | ||
| //TEST:SIMPLE(filecheck=CHECK): -target hlsl -profile lib_6_7 -stage raygeneration -entry rayGenShaderA | ||
| //TEST:SIMPLE(filecheck=DXIL): -target dxil -profile lib_6_7 -stage raygeneration -entry rayGenShaderA | ||
|
|
||
| // CHECK: struct [raypayload] | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we should check also for the correct read and write attributes in the output hlsl
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Added |
||
| // CHECK: float4 color_0 : read(caller, anyhit) : write(caller); | ||
| // DXIL: define void @ | ||
| // DXIL: !dx.dxrPayloadAnnotations | ||
|
|
||
| struct [raypayload] RayPayload | ||
| { | ||
| float4 color : read(caller, anyhit) : write(caller); | ||
| }; | ||
|
|
||
| uniform RWTexture2D<float4> resultTexture; | ||
| uniform RaytracingAccelerationStructure sceneBVH; | ||
|
|
||
| [shader("raygeneration")] | ||
| void rayGenShaderA() | ||
| { | ||
| int2 threadIdx = DispatchRaysIndex().xy; | ||
|
|
||
| float3 rayDir = float3(0, 0, 1); | ||
| float3 rayOrigin = 0; | ||
| rayOrigin.x = (threadIdx.x * 2) - 1; | ||
| rayOrigin.y = (threadIdx.y * 2) - 1; | ||
|
|
||
| // Trace the ray. | ||
| RayDesc ray; | ||
| ray.Origin = rayOrigin; | ||
| ray.Direction = rayDir; | ||
| ray.TMin = 0.001; | ||
| ray.TMax = 10000.0; | ||
| RayPayload payload = { float4(0, 0, 0, 0) }; | ||
| TraceRay(sceneBVH, RAY_FLAG_NONE, ~0, 0, 0, 0, ray, payload); | ||
|
|
||
| resultTexture[threadIdx.xy] = payload.color; | ||
| } | ||
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
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.