From c61775e634a6a52772de60e68ba6d50751d8b790 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Wed, 26 Jul 2023 16:33:48 +0000 Subject: 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 --- tests/cross-compile/glsl-texturegather.slang | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/cross-compile/glsl-texturegather.slang (limited to 'tests') 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)); +} -- cgit v1.2.3