summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit-c-like.cpp
diff options
context:
space:
mode:
authorAlexey Panteleev <alpanteleev@nvidia.com>2022-04-13 14:24:58 -0700
committerGitHub <noreply@github.com>2022-04-13 14:24:58 -0700
commit5ffd3048df2d7faf30ca8192c117d73e908212cd (patch)
tree98f4cc81a394c4274b511f4edee6a4ae90ea4680 /source/slang/slang-emit-c-like.cpp
parentc949d5005ede13840d086214d6fe64f2b0fefed5 (diff)
Callable shader fix and explicit payload locations for GLSL (#2185)
* Fixed the callable shader payload type for GLSL. * Added location parameters to the __vulkanRayPayload and __vulkanCallablePayload attributes. The default value is -1 which means use the old auto-assignment logic. * Fixed the vkray/callable-caller test.
Diffstat (limited to 'source/slang/slang-emit-c-like.cpp')
-rw-r--r--source/slang/slang-emit-c-like.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index 562a532cd..2d30c2109 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -2945,6 +2945,14 @@ void CLikeSourceEmitter::emitInterpolationModifiers(IRInst* varInst, IRType* val
UInt CLikeSourceEmitter::getRayPayloadLocation(IRInst* inst)
{
+ if (auto rayPayloadDecoration = inst->findDecoration<IRVulkanRayPayloadDecoration>())
+ {
+ int explicitLocation = int(getIntVal(rayPayloadDecoration->getOperand(0)));
+
+ if (explicitLocation >= 0)
+ return UInt(explicitLocation);
+ }
+
auto& map = m_mapIRValueToRayPayloadLocation;
UInt value = 0;
if(map.TryGetValue(inst, value))
@@ -2957,6 +2965,14 @@ UInt CLikeSourceEmitter::getRayPayloadLocation(IRInst* inst)
UInt CLikeSourceEmitter::getCallablePayloadLocation(IRInst* inst)
{
+ if (auto callablePayloadDecoration = inst->findDecoration<IRVulkanCallablePayloadDecoration>())
+ {
+ int explicitLocation = int(getIntVal(callablePayloadDecoration->getOperand(0)));
+
+ if (explicitLocation >= 0)
+ return UInt(explicitLocation);
+ }
+
auto& map = m_mapIRValueToCallablePayloadLocation;
UInt value = 0;
if(map.TryGetValue(inst, value))