[glsl-writer] Fix several bugs about storage image
This patch fixes several bugs about storage image on GLSL writer.
- Correctly translate storage texture access
- Translate textureLoad() to imageLoad() for storage images
- Add support of TextureBarrier()
Note that in this patch we translate ReadWrite storage textures with
the formats other than r32f, r32i and r32ui into "writeonly" because
using such image format without memory qualifier is illegal in ESSL
SPEC according to ESSL 3.1 SPEC (chapter 4.9, Memory Access Qualifiers):
Except for image variables qualified with the format qualifiers r32f,
r32i, and r32ui, image variables must specify either memory qualifier
readonly or the memory qualifier writeonly.
Bug: dawn:595, dawn:1972, tint:2007
Change-Id: Iebae00f7f97d28364e922087db60b395f567e1ec
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/147460
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
Reviewed-by: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/test/tint/builtins/gen/var/textureDimensions/135176.wgsl.expected.glsl b/test/tint/builtins/gen/var/textureDimensions/135176.wgsl.expected.glsl
index a0d6cd1..18f8a17 100644
--- a/test/tint/builtins/gen/var/textureDimensions/135176.wgsl.expected.glsl
+++ b/test/tint/builtins/gen/var/textureDimensions/135176.wgsl.expected.glsl
@@ -1,6 +1,6 @@
#version 310 es
-layout(r32f) uniform highp image2DArray arg_0;
+layout(r32f) uniform highp readonly image2DArray arg_0;
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec2 inner;
} prevent_dce;
@@ -26,7 +26,7 @@
#version 310 es
precision highp float;
-layout(r32f) uniform highp image2DArray arg_0;
+layout(r32f) uniform highp readonly image2DArray arg_0;
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec2 inner;
} prevent_dce;
@@ -46,7 +46,7 @@
}
#version 310 es
-layout(r32f) uniform highp image2DArray arg_0;
+layout(r32f) uniform highp readonly image2DArray arg_0;
layout(binding = 0, std430) buffer prevent_dce_block_ssbo {
uvec2 inner;
} prevent_dce;