diff options
| author | Yong He <yonghe@outlook.com> | 2024-12-18 15:34:16 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-18 15:34:16 -0800 |
| commit | 0f5a2ce2ecf79fba79a9d20c9e3bcd4c31ee45bb (patch) | |
| tree | cd3f0b8c870980199f5ef38fedae944efa357e69 /tools | |
| parent | ae04e604d43d169bcba7f24c8c23a0fdf4cbb483 (diff) | |
Fix metadata of register space and varying params. (#5906)
Diffstat (limited to 'tools')
| -rw-r--r-- | tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
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<Params> 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); } |
