summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-emit-hlsl.cpp
diff options
context:
space:
mode:
authorHarsh Aggarwal (NVIDIA) <haaggarwal@nvidia.com>2025-04-07 13:26:11 +0530
committerGitHub <noreply@github.com>2025-04-07 07:56:11 +0000
commitce87ab925d06a784eec194081e00a1b4c9b94d0c (patch)
tree086e60c0205e00e0f0e1c31761434f5e9bf5fbcb /source/slang/slang-emit-hlsl.cpp
parent1b82501dd0c74347cda4a2c7fe5a84fd610bb485 (diff)
Support for Payload Access Qualifiers (#3448) (#6595)
* Add support for Ray Payload Access Qualifiers (PAQs) (#3448) - Added [raypayload] attribute for struct declarations - Implemented field validation requiring read/write access qualifiers - Added diagnostic error for missing qualifiers - Enabled PAQs in DXC compiler and HLSL emission - Added new test demonstrating PAQ syntax - Implemented proper handling of ray payload attributes in IR generation * format code * Cleanup: Remove unused vars * Add check to enablePAQ only for profile >= lib_6_7 * Review Fix - Add PAQ support for DX Raytracing add enablePAQ flag to DownstreamCompileOpitons, improve PAQ handling update raypayload-attribute-paq.slang to ensure hlsl and dxil is validated * Add diagnostic test for missing paq for lib_6_7 Compile using `-disable-payload-qualifiers` aka lib_6_6 profile raypayload-attribute-no-struct.slang and raypayload-attribute.slang --------- Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com> Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com>
Diffstat (limited to 'source/slang/slang-emit-hlsl.cpp')
-rw-r--r--source/slang/slang-emit-hlsl.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/source/slang/slang-emit-hlsl.cpp b/source/slang/slang-emit-hlsl.cpp
index 0f1ef3ee0..2d963866d 100644
--- a/source/slang/slang-emit-hlsl.cpp
+++ b/source/slang/slang-emit-hlsl.cpp
@@ -1667,8 +1667,18 @@ void HLSLSourceEmitter::emitPostKeywordTypeAttributesImpl(IRInst* inst)
{
m_writer->emit("[payload] ");
}
- // This can be re-enabled when we add PAQs: https://github.com/shader-slang/slang/issues/3448
- const bool enablePAQs = false;
+
+ // Get the target profile to determine if PAQs are supported
+ bool enablePAQs = false;
+ auto profile = getTargetProgram()->getOptionSet().getProfile();
+ if (profile.getFamily() == ProfileFamily::DX)
+ {
+ // PAQs are default in Shader Model 6.7 and above when called with `--profile lib_6_7`
+
+ auto version = profile.getVersion();
+ enablePAQs = version >= ProfileVersion::DX_6_7;
+ }
+
if (enablePAQs)
{
if (const auto payloadDecoration = inst->findDecoration<IRRayPayloadDecoration>())