From cd45d092260c116637095ea50b7329bf00310aba Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Fri, 12 Jul 2019 15:50:38 +0200 Subject: [PATCH] glsl: handle differences between ARB/EXT versions of shader_image_load_store MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Reviewed-by: Marek Olšák --- src/compiler/glsl/ast_to_hir.cpp | 3 ++- src/compiler/glsl/builtin_functions.cpp | 14 +++++++++++++- src/compiler/glsl/glsl_parser_extras.cpp | 1 + src/compiler/glsl/glsl_parser_extras.h | 6 +++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index d7c396aa0eb..2e351706c22 100644 --- a/src/compiler/glsl/ast_to_hir.cpp +++ b/src/compiler/glsl/ast_to_hir.cpp @@ -3488,7 +3488,8 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual, } } else { if (var->data.mode == ir_var_uniform) { - if (state->es_shader) { + if (state->es_shader || + !(state->is_version(420, 310) || state->ARB_shader_image_load_store_enable)) { _mesa_glsl_error(loc, state, "all image uniforms must have a " "format layout qualifier"); } else if (!qual->flags.q.write_only) { diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp index ff5d9a72da2..095eb84055a 100644 --- a/src/compiler/glsl/builtin_functions.cpp +++ b/src/compiler/glsl/builtin_functions.cpp @@ -674,7 +674,14 @@ static bool shader_image_load_store(const _mesa_glsl_parse_state *state) { return (state->is_version(420, 310) || - state->ARB_shader_image_load_store_enable); + state->ARB_shader_image_load_store_enable || + state->EXT_shader_image_load_store_enable); +} + +static bool +shader_image_load_store_ext(const _mesa_glsl_parse_state *state) +{ + return state->EXT_shader_image_load_store_enable; } static bool @@ -682,6 +689,7 @@ shader_image_atomic(const _mesa_glsl_parse_state *state) { return (state->is_version(420, 320) || state->ARB_shader_image_load_store_enable || + state->EXT_shader_image_load_store_enable || state->OES_shader_image_atomic_enable); } @@ -1194,6 +1202,7 @@ enum image_function_flags { IMAGE_FUNCTION_MS_ONLY = (1 << 7), IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE = (1 << 8), IMAGE_FUNCTION_AVAIL_ATOMIC_ADD = (1 << 9), + IMAGE_FUNCTION_EXT_ONLY = (1 << 10), }; } /* anonymous namespace */ @@ -6936,6 +6945,9 @@ get_image_available_predicate(const glsl_type *type, unsigned flags) IMAGE_FUNCTION_AVAIL_ATOMIC)) return shader_image_atomic; + else if (flags & IMAGE_FUNCTION_EXT_ONLY) + return shader_image_load_store_ext; + else return shader_image_load_store; } diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp index 15f271234d5..e4a7e3dbf70 100644 --- a/src/compiler/glsl/glsl_parser_extras.cpp +++ b/src/compiler/glsl/glsl_parser_extras.cpp @@ -725,6 +725,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = { EXT(EXT_shader_framebuffer_fetch), EXT(EXT_shader_framebuffer_fetch_non_coherent), EXT(EXT_shader_image_load_formatted), + EXT(EXT_shader_image_load_store), EXT(EXT_shader_implicit_conversions), EXT(EXT_shader_integer_mix), EXT_AEP(EXT_shader_io_blocks), diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index c132556c276..5aaf0bc252b 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -337,7 +337,9 @@ struct _mesa_glsl_parse_state { bool has_shader_image_load_store() const { - return ARB_shader_image_load_store_enable || is_version(420, 310); + return ARB_shader_image_load_store_enable || + EXT_shader_image_load_store_enable || + is_version(420, 310); } bool has_bindless() const @@ -836,6 +838,8 @@ struct _mesa_glsl_parse_state { bool EXT_shader_framebuffer_fetch_non_coherent_warn; bool EXT_shader_image_load_formatted_enable; bool EXT_shader_image_load_formatted_warn; + bool EXT_shader_image_load_store_enable; + bool EXT_shader_image_load_store_warn; bool EXT_shader_implicit_conversions_enable; bool EXT_shader_implicit_conversions_warn; bool EXT_shader_integer_mix_enable; -- 2.30.2