summaryrefslogtreecommitdiff
path: root/tests/compute
diff options
context:
space:
mode:
Diffstat (limited to 'tests/compute')
-rw-r--r--tests/compute/dynamic-dispatch-bindless-texture.slang40
-rw-r--r--tests/compute/dynamic-dispatch-bindless-texture.slang.expected.txt4
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/compute/dynamic-dispatch-bindless-texture.slang b/tests/compute/dynamic-dispatch-bindless-texture.slang
new file mode 100644
index 000000000..49265fac4
--- /dev/null
+++ b/tests/compute/dynamic-dispatch-bindless-texture.slang
@@ -0,0 +1,40 @@
+// Test using interface typed shader parameters with texture typed fields.
+//TEST(compute):COMPARE_COMPUTE:-cpu
+//TEST(compute):COMPARE_COMPUTE:-cuda
+
+[anyValueSize(8)]
+interface IInterface
+{
+ float run();
+}
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=gOutputBuffer
+RWStructuredBuffer<uint> gOutputBuffer;
+//TEST_INPUT: Texture2D(size=8, content = one):name t2D,bindless
+//TEST_INPUT:ubuffer(data=[rtti(MyImpl) witness(MyImpl, IInterface) handle(t2D) 0 0], stride=4):name=gCb
+StructuredBuffer<IInterface> gCb;
+
+[numthreads(4, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ let tid = dispatchThreadID.x;
+
+ let inputVal : int = tid;
+ IInterface v0 = gCb.Load(0);
+ SamplerState sampler;
+ let outputVal = v0.run();
+ gOutputBuffer[tid] = trunc(outputVal);
+}
+
+//TEST_INPUT: globalExistentialType __Dynamic
+
+// Type must be marked `public` to ensure it is visible in the generated DLL.
+public struct MyImpl : IInterface
+{
+ Texture2D tex;
+ SamplerState sampler;
+ float run()
+ {
+ return tex.Sample(sampler, float2(0.0, 0.0)).x;
+ }
+};
diff --git a/tests/compute/dynamic-dispatch-bindless-texture.slang.expected.txt b/tests/compute/dynamic-dispatch-bindless-texture.slang.expected.txt
new file mode 100644
index 000000000..98fb6a686
--- /dev/null
+++ b/tests/compute/dynamic-dispatch-bindless-texture.slang.expected.txt
@@ -0,0 +1,4 @@
+1
+1
+1
+1