From 251f55c5ec4cb2b7432e71d6ba8adc96700d35c2 Mon Sep 17 00:00:00 2001 From: Jay Kwak <82421531+jkwak-work@users.noreply.github.com> Date: Mon, 1 Apr 2024 22:02:25 -0700 Subject: Support SM6.6 keyword "WaveSize" (#3871) Resolves an issue #3385 Shader Model 6.6 added a new keyowrd, "WaveSize". See the following link for more details: https://microsoft.github.io/DirectX-Specs/d3d/HLSL_SM_6_6_WaveSize.html Co-authored-by: Yong He --- source/slang/slang-reflection-api.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'source/slang/slang-reflection-api.cpp') 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()) + { + 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) { -- cgit v1.2.3