summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source/slang/core.meta.slang10
-rw-r--r--tests/hlsl-intrinsic/texture/gather-texture2darray.slang16
-rw-r--r--tests/hlsl-intrinsic/texture/gather-texture2darray.slang.hlsl14
-rw-r--r--tools/slang-test/slang-test-main.cpp2
4 files changed, 37 insertions, 5 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index 65da2af92..5ba31fc33 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -1459,24 +1459,24 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
sb << "__target_intrinsic(cuda, \"tex2Dgather<$T0>($0, ($2).x, ($2).y, " << componentIndex << ")\")\n";
}
sb << outputType << " Gather" << componentName << "(SamplerState s, ";
- sb << "float" << kBaseTextureTypes[tt].coordCount << " location);\n";
+ sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location);\n";
EMIT_LINE_DIRECTIVE();
sb << "__target_intrinsic(glsl, \"textureGatherOffset($p, $2, $3, " << componentIndex << ")\")\n";
sb << outputType << " Gather" << componentName << "(SamplerState s, ";
- sb << "float" << kBaseTextureTypes[tt].coordCount << " location, ";
+ sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, ";
sb << "constexpr int" << kBaseTextureTypes[tt].coordCount << " offset);\n";
EMIT_LINE_DIRECTIVE();
sb << outputType << " Gather" << componentName << "(SamplerState s, ";
- sb << "float" << kBaseTextureTypes[tt].coordCount << " location, ";
+ sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, ";
sb << "constexpr int" << kBaseTextureTypes[tt].coordCount << " offset, ";
sb << "out uint status);\n";
EMIT_LINE_DIRECTIVE();
sb << "__target_intrinsic(glsl, \"textureGatherOffsets($p, $2, int" << kBaseTextureTypes[tt].coordCount << "[]($3, $4, $5, $6), " << componentIndex << ")\")\n";
sb << outputType << " Gather" << componentName << "(SamplerState s, ";
- sb << "float" << kBaseTextureTypes[tt].coordCount << " location, ";
+ sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset1, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset2, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset3, ";
@@ -1484,7 +1484,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
EMIT_LINE_DIRECTIVE();
sb << outputType << " Gather" << componentName << "(SamplerState s, ";
- sb << "float" << kBaseTextureTypes[tt].coordCount << " location, ";
+ sb << "float" << kBaseTextureTypes[tt].coordCount + isArray << " location, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset1, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset2, ";
sb << "int" << kBaseTextureTypes[tt].coordCount << " offset3, ";
diff --git a/tests/hlsl-intrinsic/texture/gather-texture2darray.slang b/tests/hlsl-intrinsic/texture/gather-texture2darray.slang
new file mode 100644
index 000000000..49ce8e6a1
--- /dev/null
+++ b/tests/hlsl-intrinsic/texture/gather-texture2darray.slang
@@ -0,0 +1,16 @@
+// gather-texture2darray.slang
+
+//TEST:CROSS_COMPILE: -target dxbc -profile sm_5_1 -entry main -stage compute
+
+// Test gathering from a `Texture2DArray`
+
+Texture2DArray<uint> t;
+SamplerState s;
+RWBuffer<uint4> b;
+
+[shader("compute")]
+[numthreads(32, 1, 1)]
+void main(uint3 tid : SV_DispatchThreadID)
+{
+ b[tid.x] = t.Gather(s, tid);
+}
diff --git a/tests/hlsl-intrinsic/texture/gather-texture2darray.slang.hlsl b/tests/hlsl-intrinsic/texture/gather-texture2darray.slang.hlsl
new file mode 100644
index 000000000..de07f93ca
--- /dev/null
+++ b/tests/hlsl-intrinsic/texture/gather-texture2darray.slang.hlsl
@@ -0,0 +1,14 @@
+// gather-texture2darray.slang.hlsl
+
+//TEST_IGNORE_FILE:
+
+Texture2DArray<uint> t_0;
+SamplerState s_0;
+RWBuffer<uint4> b_0;
+
+[shader("compute")]
+[numthreads(32, 1, 1)]
+void main(uint3 tid : SV_DISPATCHTHREADID)
+{
+ b_0[tid.x] = t_0.Gather(s_0, tid);
+}
diff --git a/tools/slang-test/slang-test-main.cpp b/tools/slang-test/slang-test-main.cpp
index 25aa13986..1144b4034 100644
--- a/tools/slang-test/slang-test-main.cpp
+++ b/tools/slang-test/slang-test-main.cpp
@@ -1732,6 +1732,7 @@ TestResult runCrossCompilerTest(TestContext* context, TestInput& input)
switch (target)
{
+ case SLANG_DXIL:
case SLANG_DXIL_ASM:
{
expectedCmdLine.addArg(filePath + ".hlsl");
@@ -1739,6 +1740,7 @@ TestResult runCrossCompilerTest(TestContext* context, TestInput& input)
expectedCmdLine.addArg("dxc");
break;
}
+ case SLANG_DXBC:
case SLANG_DXBC_ASM:
{
expectedCmdLine.addArg(filePath + ".hlsl");