summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-07-30 10:52:45 -0700
committerGitHub <noreply@github.com>2024-07-30 10:52:45 -0700
commitc94fd84eff090f326403e67e712bf38e9e27c36c (patch)
tree839fb52c1a9eec4d354b04a85a3d02de96f588aa /tests
parent7e2bc8e06f61d554bae9bbebc1db0302eb3f1d8a (diff)
Fix SPIRV emit for small-integer texture types. (#4753)
* Fix SPIRV emit for small-integer texture types. * Disable -emit-spirv-via-glsl test.
Diffstat (limited to 'tests')
-rw-r--r--tests/spirv/small-int-texture.slang17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/spirv/small-int-texture.slang b/tests/spirv/small-int-texture.slang
new file mode 100644
index 000000000..b20ae35fe
--- /dev/null
+++ b/tests/spirv/small-int-texture.slang
@@ -0,0 +1,17 @@
+// Test that we can translate textures whose element type is a small integer type to valid spirv.
+
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -output-using-type -emit-spirv-directly
+
+//TEST_INPUT: RWTexture2D(format=R8_UINT, size=4, content = one, mipMaps = 1):name g_Image
+RWTexture2D<uint8_t> g_Image;
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<int> outputBuffer;
+
+[numthreads(1, 1, 1)]
+void computeMain(int id: SV_DispatchThreadID) {
+ g_Image[id] = uint8_t(23);
+ AllMemoryBarrier();
+ // CHECK: 23
+ outputBuffer[0] = g_Image[id];
+} \ No newline at end of file