summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/hlsl/tbuffer.slang40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/hlsl/tbuffer.slang b/tests/hlsl/tbuffer.slang
new file mode 100644
index 000000000..a1bebf2e1
--- /dev/null
+++ b/tests/hlsl/tbuffer.slang
@@ -0,0 +1,40 @@
+//TEST:SIMPLE(filecheck=HLSL): -target hlsl -stage compute -entry computeMain
+//TEST:SIMPLE(filecheck=GLSL): -target glsl -stage compute -entry computeMain
+
+// Metal backend requires a new legalization pass to support emitting `TextureBufferType`
+//DISABLE_TEST:SIMPLE(filecheck=METAL): -target metal -stage compute -entry computeMain
+//DISABLE_TEST:SIMPLE(filecheck=METALLIB): -target metallib -stage compute -entry computeMain
+
+// SPIRV backend has no support for emitting `TextureBufferType`
+//DISABLE_TEST:SIMPLE(filecheck=SPIRV): -target spirv -stage compute -entry computeMain
+
+tbuffer tbuf : register(t0)
+{
+ float4 tb_val1;
+}
+
+tbuffer tbuf2 : register(t1)
+{
+ Texture2D<float4> texture2D;
+ float4 tb_val2;
+}
+
+
+// HLSL-DAG: t0
+// HLSL-DAG: t1
+// HLSL-DAG: t2
+
+// GLSL-DAG: binding = 0
+// GLSL-DAG: binding = 1
+// GLSL-DAG: binding = 2
+
+// METAL-DAG: [texture(0)]
+// METAL-DAG: [texture(1)]
+// METAL-DAG: [texture(2)]
+// METALLIB: @computeMain
+
+RWStructuredBuffer<float4> outputBuffer;
+[numthreads(1,1,1)]
+float4 computeMain() {
+ outputBuffer[0] = tb_val1 + texture2D[0] + tb_val2;
+}