From b1d0ecd00d99a0900726b431ac2441a64e9775a8 Mon Sep 17 00:00:00 2001 From: Qiang Yu Date: Wed, 12 Jun 2024 18:27:04 +0800 Subject: [PATCH] glsl: respect GL_EXT_shader_image_load_formatted when image is embedded in a struct MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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: 082d180a22ff ("mesa, glsl: add support for EXT_shader_image_load_formatted") Reviewed-by: Marek Olšák Signed-off-by: Qiang Yu Part-of: --- src/compiler/glsl/ast_to_hir.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index 93e989f31b7..12f46442c06 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -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");