summaryrefslogtreecommitdiffstats
path: root/tests/wgsl
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-10-30 14:07:38 -0700
committerGitHub <noreply@github.com>2024-10-30 14:07:38 -0700
commit28f20f458c4f7f587556a1738d63b70e87c2b148 (patch)
treea3d4fbd77be026979fd5f9802dcbe01404e20396 /tests/wgsl
parentfeec3cf4354524e2badb3e3165fdf2a17c24597e (diff)
Write only texture types. (#5454)
* Add support for write-only textures. * Fix capabilities. * Fix implementation. * Fix. * format code --------- Co-authored-by: Ellie Hermaszewska <ellieh@nvidia.com> Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/wgsl')
-rw-r--r--tests/wgsl/write-only-texture.slang24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/wgsl/write-only-texture.slang b/tests/wgsl/write-only-texture.slang
new file mode 100644
index 000000000..56034ce6a
--- /dev/null
+++ b/tests/wgsl/write-only-texture.slang
@@ -0,0 +1,24 @@
+//TEST:REFLECTION(filecheck=REFLECT):-stage compute -entry computeMain -target wgsl -no-codegen
+//TEST:SIMPLE(filecheck=SPV): -target spirv
+//TEST:SIMPLE(filecheck=CHECK): -target wgsl -entry computeMain -stage compute
+//TEST:SIMPLE(filecheck=CHECK-WGSL-SPV): -target wgsl-spirv-asm -entry computeMain -stage compute
+//TEST:SIMPLE(filecheck=HLSL): -target hlsl -entry computeMain -profile cs_6_0
+//TEST:SIMPLE(filecheck=GLSL): -target glsl -entry computeMain -stage compute
+
+// CHECK: texture_storage_2d<rgba8unorm, write>
+// CHECK-WGSL-SPV: OpTypeImage %float 2D {{.}} 0 0 2 Rgba8
+// SPV: OpTypeImage %float 2D {{.}} 0 0 2 Rgba8
+// HLSL: RWTexture2D
+// GLSL: image2D
+
+// REFLECT: "name": "writeOnlyTexture"
+// REFLECT: "access": "write"
+
+[format("rgba8")]
+WTexture2D writeOnlyTexture;
+
+[shader("compute")]
+void computeMain()
+{
+ writeOnlyTexture.Store(int2(0,0), float4(0.2, 0.3, 0.4, 1.0));
+} \ No newline at end of file