summaryrefslogtreecommitdiffstats
path: root/tests/cross-compile
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-07-26 16:33:48 +0000
committerGitHub <noreply@github.com>2023-07-26 09:33:48 -0700
commitc61775e634a6a52772de60e68ba6d50751d8b790 (patch)
tree17e645be935f26f15f4ddc114fbe025f958fbfb0 /tests/cross-compile
parentd47d54928f46f1c869c8cca5cf67b310fd18cb1d (diff)
Add GatherCmp* for texture objects (#3024)
The translation to GLSL is incomplete as intrinsics only exist for some combination of comparison and channel (just channel 0) Closes https://github.com/shader-slang/slang/issues/3021
Diffstat (limited to 'tests/cross-compile')
-rw-r--r--tests/cross-compile/glsl-texturegather.slang20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/cross-compile/glsl-texturegather.slang b/tests/cross-compile/glsl-texturegather.slang
new file mode 100644
index 000000000..125cf6df1
--- /dev/null
+++ b/tests/cross-compile/glsl-texturegather.slang
@@ -0,0 +1,20 @@
+//TEST:CROSS_COMPILE(filecheck=CHECK): -profile ps_5_0 -entry main -target glsl
+
+// CHECK: textureGather(sampler2DShadow(t_0,sc_0), (loc_0), (3.0))
+// CHECK: textureGatherOffset(sampler2DShadow(t_0,sc_0), (loc_0), (3.0), (off_0))
+// CHECK: textureGatherOffsets(sampler2DShadow(t_0,sc_0), (loc_0), (3.0), ivec2[]((off_0), (off_0), (off_0), (off_0)))
+// CHECK: textureGatherOffsets(sampler2DShadow(t_0,sc_0), (loc_0), (3.0), ivec2[]((ivec2(6, 6)), (ivec2(7, 7)), (ivec2(8, 8)), (ivec2(9, 9))))
+
+Texture2D t;
+SamplerState s;
+SamplerComparisonState sc;
+float4 main()
+{
+ const float2 loc = float2(1,2);
+ const float cmp = 3;
+ const int2 off = int2(4,5);
+ return t.GatherCmp(sc, loc, cmp)
+ + t.GatherCmp(sc, loc, cmp, off)
+ + t.GatherCmp(sc, loc, cmp, off, off, off, off)
+ + t.GatherCmpRed(sc, loc, cmp, int2(6,6), int2(7,7), int2(8,8), int2(9,9));
+}