summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-reflection-api.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-reflection-api.cpp')
-rw-r--r--source/slang/slang-reflection-api.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp
index 9b20e2933..90103d8d9 100644
--- a/source/slang/slang-reflection-api.cpp
+++ b/source/slang/slang-reflection-api.cpp
@@ -2840,6 +2840,28 @@ SLANG_API void spReflectionEntryPoint_getComputeThreadGroupSize(
}
}
+SLANG_API void spReflectionEntryPoint_getComputeWaveSize(
+ SlangReflectionEntryPoint* inEntryPoint,
+ SlangUInt* outWaveSize)
+{
+ auto entryPointLayout = convert(inEntryPoint);
+
+ if (!entryPointLayout) return;
+ if (!outWaveSize) return;
+
+ auto entryPointFunc = entryPointLayout->entryPoint;
+ if (!entryPointFunc) return;
+
+ // First look for the HLSL case, where we have an attribute attached to the entry point function
+ if (auto waveSizeAttribute = entryPointFunc.getDecl()->findModifier<WaveSizeAttribute>())
+ {
+ if (auto cint = entryPointLayout->program->tryFoldIntVal(waveSizeAttribute->numLanes))
+ *outWaveSize = (SlangUInt)cint->getValue();
+ else if (waveSizeAttribute->numLanes)
+ *outWaveSize = 0;
+ }
+}
+
SLANG_API int spReflectionEntryPoint_usesAnySampleRateInput(
SlangReflectionEntryPoint* inEntryPoint)
{