From 5ffd3048df2d7faf30ca8192c117d73e908212cd Mon Sep 17 00:00:00 2001 From: Alexey Panteleev Date: Wed, 13 Apr 2022 14:24:58 -0700 Subject: 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. --- source/slang/slang-check-modifier.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'source/slang/slang-check-modifier.cpp') diff --git a/source/slang/slang-check-modifier.cpp b/source/slang/slang-check-modifier.cpp index e597407e2..320b980e9 100644 --- a/source/slang/slang-check-modifier.cpp +++ b/source/slang/slang-check-modifier.cpp @@ -539,6 +539,24 @@ namespace Slang } dllImportAttr->modulePath = libraryName; } + else if (auto rayPayloadAttr = as(attr)) + { + SLANG_ASSERT(attr->args.getCount() == 1); + auto val = checkConstantIntVal(attr->args[0]); + + if (!val) return false; + + rayPayloadAttr->location = (int32_t)val->value; + } + else if (auto callablePayloadAttr = as(attr)) + { + SLANG_ASSERT(attr->args.getCount() == 1); + auto val = checkConstantIntVal(attr->args[0]); + + if (!val) return false; + + callablePayloadAttr->location = (int32_t)val->value; + } else { if(attr->args.getCount() == 0) -- cgit v1.2.3