summaryrefslogtreecommitdiffstats
path: root/tests/cross-compile
diff options
context:
space:
mode:
authorPankaj Mistry <63069047+pmistryNV@users.noreply.github.com>2024-01-02 16:22:59 -0800
committerGitHub <noreply@github.com>2024-01-02 16:22:59 -0800
commitf33485c105b354a5a183732f47b9ca59c10ea08f (patch)
treee2c2501bd2aebb3f36d9fdd57287e8e98ac5c13c /tests/cross-compile
parentf1f5e60ac541811b33172be78415474087b37571 (diff)
Update the GetDimension hlsl builtin for spirv path. In case of sampler, a combined sampled image needs an OpImage to be generated. (#3424)
Diffstat (limited to 'tests/cross-compile')
-rw-r--r--tests/cross-compile/vk-sampler-getdimension.slang33
1 files changed, 33 insertions, 0 deletions
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;
+}