From 0f5a2ce2ecf79fba79a9d20c9e3bcd4c31ee45bb Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 18 Dec 2024 15:34:16 -0800 Subject: Fix metadata of register space and varying params. (#5906) --- .../unit-test-parameter-usage-reflection.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) (limited to 'tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp') 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 ce9df5a42..e4a89a277 100644 --- a/tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp +++ b/tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp @@ -18,10 +18,15 @@ SLANG_UNIT_TEST(isParameterLocationUsedReflection) // Source for a module that contains an undecorated entrypoint. const char* userSourceBody = R"( Texture2D g_tex : register(t0); + struct Params { + Texture2D tex2; + Texture2D tex3; + }; + ParameterBlock gParams; [shader("fragment")] - float4 fragMain(float4 pos:SV_Position) : SV_Target + float4 fragMain(float4 pos:SV_Position, float unused:COLOR0, float4 used:COLOR1) : SV_Target { - return g_tex.Load(int3(0, 0, 0)); + return g_tex.Load(int3(0, 0, 0)) + gParams.tex3.Load(int3(0)) + used; } )"; @@ -75,4 +80,16 @@ SLANG_UNIT_TEST(isParameterLocationUsedReflection) metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_DESCRIPTOR_TABLE_SLOT, 0, 1, isUsed); SLANG_CHECK(!isUsed); + + metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_DESCRIPTOR_TABLE_SLOT, 1, 0, isUsed); + SLANG_CHECK(!isUsed); + + metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_DESCRIPTOR_TABLE_SLOT, 1, 1, isUsed); + SLANG_CHECK(isUsed); + + metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_VARYING_INPUT, 0, 0, isUsed); + SLANG_CHECK(!isUsed); + + metadata->isParameterLocationUsed(SLANG_PARAMETER_CATEGORY_VARYING_INPUT, 0, 1, isUsed); + SLANG_CHECK(isUsed); } -- cgit v1.2.3