summaryrefslogtreecommitdiff
path: root/tests/cross-compile/rw-buffer.slang
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2020-02-05 10:16:14 -0800
committerGitHub <noreply@github.com>2020-02-05 10:16:14 -0800
commit122126c006e53bd48064f220104d425b8bf91ddf (patch)
treece3568d59c1e25c0a3be26994f4d8204dae20335 /tests/cross-compile/rw-buffer.slang
parent17c6c6044965629a3ae7e8ef004cc0b2ca657c55 (diff)
Add support for RWBuffer writes on GLSL/SPIR-V target (#1199)
This appears to have been an oversight in the work that added support for `imageStore` as well as atomics when writing to `RWTexture*` and friends. The HLSL/Slang `RWBuffer` type maps to GLSL as an `imageBuffer`, which is effectively just another case of writable texture image (bonus points to anybody who can explain to me the meaningful distinction between an `imageBuffer` and an `image1D`). This change copies the handling of subscript access (`operator[]`) from textures over to buffers, and adds a test case to confirm that the new handling works for the simple case of setting a buffer element.
Diffstat (limited to 'tests/cross-compile/rw-buffer.slang')
-rw-r--r--tests/cross-compile/rw-buffer.slang14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/cross-compile/rw-buffer.slang b/tests/cross-compile/rw-buffer.slang
new file mode 100644
index 000000000..f5246ed78
--- /dev/null
+++ b/tests/cross-compile/rw-buffer.slang
@@ -0,0 +1,14 @@
+// rw-buffer.slang
+
+// Confirm that writing into a `RWBuffer` generates appropriate GLSL/SPIR-V.
+
+//TEST:CROSS_COMPILE: -profile ps_5_0 -entry main -target spirv-assembly
+
+RWBuffer<float> buffer;
+
+
+float4 main(float u : U, int idx : IDX) : SV_Target
+{
+ buffer[idx] = u;
+ return u;
+}