From: Pierre-Eric Pelloux-Prayer Date: Fri, 12 Jul 2019 13:50:38 +0000 (+0200) Subject: glsl: handle differences between ARB/EXT versions of shader_image_load_store X-Git-Tag: upstream/19.3.0~3244 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cd45d092260c116637095ea50b7329bf00310aba;p=platform%2Fupstream%2Fmesa.git glsl: handle differences between ARB/EXT versions of shader_image_load_store Reviewed-by: Marek Olšák --- diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp index d7c396a..2e35170 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 ff5d9a7..095eb84 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 15f2712..e4a7e3d 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 c132556..5aaf0bc 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;