From f33485c105b354a5a183732f47b9ca59c10ea08f Mon Sep 17 00:00:00 2001 From: Pankaj Mistry <63069047+pmistryNV@users.noreply.github.com> Date: Tue, 2 Jan 2024 16:22:59 -0800 Subject: Update the GetDimension hlsl builtin for spirv path. In case of sampler, a combined sampled image needs an OpImage to be generated. (#3424) --- tests/cross-compile/vk-sampler-getdimension.slang | 33 +++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/cross-compile/vk-sampler-getdimension.slang (limited to 'tests/cross-compile') diff --git a/tests/cross-compile/vk-sampler-getdimension.slang b/tests/cross-compile/vk-sampler-getdimension.slang new file mode 100644 index 000000000..ca0a5ce11 --- /dev/null +++ b/tests/cross-compile/vk-sampler-getdimension.slang @@ -0,0 +1,33 @@ +// vk-sampler-getdimension.slang + +//TEST:SIMPLE(filecheck=CHECK):-target spirv -entry main -stage fragment -emit-spirv-directly + +// Input to the fragment shader. +struct PSin +{ + float3 position : POSITION; +}; + +// Output of the fragment shader +struct PSout +{ + float4 color : SV_Target; +}; + +[[vk::binding(1)]] Sampler3D g_Volume; + +// Fragment Shader +[shader("pixel")] +PSout main(PSin stage, bool isFrontFacing : SV_IsFrontFace) +{ + // CHECK: %image{{.*}} = OpImage + // CHECK: OpImageQuerySizeLod %{{.*}} %image{{.*}} + PSout output; + // Find normal at position + uint3 dim; + uint levels; + g_Volume.GetDimensions(0, dim.x, dim.y, dim.z, levels); + output.color = g_Volume.Sample(float3(dim)); + + return output; +} -- cgit v1.2.3