From 5df3a74af9beb1e31fd1ed7975b4d9949b923126 Mon Sep 17 00:00:00 2001 From: Yong He Date: Fri, 3 Jan 2025 14:10:42 -0800 Subject: Fix parameter location reflection for pure data paramblocks. (#5956) --- .../unit-test-parameter-usage-reflection.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tools') diff --git a/tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp b/tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp index e4a89a277..05acfc9c2 100644 --- a/tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp +++ b/tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp @@ -22,11 +22,18 @@ SLANG_UNIT_TEST(isParameterLocationUsedReflection) Texture2D tex2; Texture2D tex3; }; + struct Material + { + float2 uvScale; + float2 uvBias; + } ParameterBlock gParams; + ConstantBuffer gcMaterial; + ParameterBlock gMaterial; [shader("fragment")] float4 fragMain(float4 pos:SV_Position, float unused:COLOR0, float4 used:COLOR1) : SV_Target { - return g_tex.Load(int3(0, 0, 0)) + gParams.tex3.Load(int3(0)) + used; + return g_tex.Load(int3(0, 0, 0)) + gParams.tex3.Load(int3(0)) + used + gMaterial.uvScale.x + gcMaterial.uvBias.x; } )"; @@ -79,6 +86,9 @@ SLANG_UNIT_TEST(isParameterLocationUsedReflection) SLANG_CHECK(isUsed); metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_DESCRIPTOR_TABLE_SLOT, 0, 1, isUsed); + SLANG_CHECK(isUsed); + + metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_DESCRIPTOR_TABLE_SLOT, 0, 2, isUsed); SLANG_CHECK(!isUsed); metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_DESCRIPTOR_TABLE_SLOT, 1, 0, isUsed); @@ -87,6 +97,9 @@ SLANG_UNIT_TEST(isParameterLocationUsedReflection) metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_DESCRIPTOR_TABLE_SLOT, 1, 1, isUsed); SLANG_CHECK(isUsed); + metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_DESCRIPTOR_TABLE_SLOT, 2, 0, isUsed); + SLANG_CHECK(isUsed); + metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_VARYING_INPUT, 0, 0, isUsed); SLANG_CHECK(!isUsed); -- cgit v1.2.3