glsl: handle differences between ARB/EXT versions of shader_image_load_store
authorPierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Fri, 12 Jul 2019 13:50:38 +0000 (15:50 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Tue, 6 Aug 2019 21:40:55 +0000 (17:40 -0400)
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
src/compiler/glsl/ast_to_hir.cpp
src/compiler/glsl/builtin_functions.cpp
src/compiler/glsl/glsl_parser_extras.cpp
src/compiler/glsl/glsl_parser_extras.h

index d7c396aa0ebdf0ab82b4da6ac09705362131ba69..2e351706c22be9c1de725cd4916679b71f9c3dbf 100644 (file)
@@ -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) {
index ff5d9a72da29a785863d6fcdedd6986d3ae5d66e..095eb84055ac710d3487d4b29c1a2ffa24a4e6fc 100644 (file)
@@ -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;
 }
index 15f271234d5446dfbb15905938afaaaf632598d9..e4a7e3dbf707bf3047b0db8d1005c779032298db 100644 (file)
@@ -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),
index c132556c27656dc3efd076d017bb399b5fbb4ae8..5aaf0bc252baaa6e4dbe2aa35c0c524ba97edb28 100644 (file)
@@ -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;