glsl: respect GL_EXT_shader_image_load_formatted when image is embedded in a struct

Fix compilation failure when image is embedded in struct when
GL_EXT_shader_image_load_formatted is enabled:

  struct GpuPointShadow {
      image2D RayTracedShadowMapImage;
  };

  layout(std140, binding = 2) uniform ShadowsUBO {
      GpuPointShadow PointShadows[1];
  } shadowsUBO;

Compile log:
  error: image not qualified with `writeonly' must have a format layout qualifier

Fixes: 082d180a22 ("mesa, glsl: add support for EXT_shader_image_load_formatted")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29693>
(cherry picked from commit b1d0ecd00d)
This commit is contained in:
Qiang Yu 2024-06-12 18:27:04 +08:00 committed by Eric Engestrom
parent d1bc625bd1
commit 59ebedc1e9
2 changed files with 6 additions and 2 deletions

View file

@ -1624,7 +1624,7 @@
"description": "glsl: respect GL_EXT_shader_image_load_formatted when image is embedded in a struct",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "082d180a22ff14ce455cefba2c525c9857f0d00e",
"notes": null

View file

@ -7902,7 +7902,11 @@ ast_process_struct_or_iface_block_members(exec_list *instructions,
fields[i].image_format = qual->image_format;
} else {
if (!qual->flags.q.write_only) {
if (state->has_image_load_formatted()) {
if (state->EXT_shader_image_load_formatted_warn) {
_mesa_glsl_warning(&loc, state, "GL_EXT_image_load_formatted used");
}
} else if (!qual->flags.q.write_only) {
_mesa_glsl_error(&loc, state, "image not qualified with "
"`writeonly' must have a format layout "
"qualifier");