summaryrefslogtreecommitdiffstats
path: root/tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2025-01-03 14:10:42 -0800
committerGitHub <noreply@github.com>2025-01-03 14:10:42 -0800
commit5df3a74af9beb1e31fd1ed7975b4d9949b923126 (patch)
tree0c358b6689be8235a9844939d5951e9b50f492aa /tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp
parentd48cd130aacbab34bb98d51bb237ad38ff37348c (diff)
Fix parameter location reflection for pure data paramblocks. (#5956)
Diffstat (limited to 'tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp')
-rw-r--r--tools/slang-unit-test/unit-test-parameter-usage-reflection.cpp15
1 files changed, 14 insertions, 1 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 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<Params> gParams;
+ ConstantBuffer<Material> gcMaterial;
+ ParameterBlock<Material> 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);