[Mesa-dev] [PATCH v3 2/5] mesa, glsl: add support for EXT_shader_image_load_formatted

Ilia Mirkin imirkin at alum.mit.edu
Thu Jan 17 03:55:05 UTC 2019


On Wed, Jan 16, 2019 at 6:20 PM Rhys Perry <pendingchaos02 at gmail.com> wrote:
>
> v3: rebase
>
> Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
> Reviewed-by: Marek Olšák <marek.olsak at amd.com> (v2)
> ---
>  src/compiler/glsl/ast_to_hir.cpp         | 5 +++++
>  src/compiler/glsl/glsl_parser_extras.cpp | 1 +
>  src/compiler/glsl/glsl_parser_extras.h   | 7 +++++++
>  src/mesa/main/extensions_table.h         | 1 +
>  src/mesa/main/mtypes.h                   | 1 +
>  5 files changed, 15 insertions(+)
>
> diff --git a/src/compiler/glsl/ast_to_hir.cpp b/src/compiler/glsl/ast_to_hir.cpp
> index 67a5a8c050..d9a57d37f6 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -3476,6 +3476,11 @@ apply_image_qualifier_to_variable(const struct ast_type_qualifier *qual,
>        }
>
>        var->data.image_format = qual->image_format;
> +   } else if (state->has_image_load_formatted()) {
> +      if (var->data.mode == ir_var_uniform &&
> +          state->EXT_shader_image_load_formatted_warn) {
> +         _mesa_glsl_warning(loc, state, "GL_EXT_image_load_formatted used");
> +      }

In the other case, we set var->data.image_format = GL_NONE. I know
that's zero, and I think this stuff is zero-initialized, but you
should also do this here for consistency.

>     } else {
>        if (var->data.mode == ir_var_uniform) {
>           if (state->es_shader) {
> diff --git a/src/compiler/glsl/glsl_parser_extras.cpp b/src/compiler/glsl/glsl_parser_extras.cpp
> index 2048a7f900..1e035e94d8 100644
> --- a/src/compiler/glsl/glsl_parser_extras.cpp
> +++ b/src/compiler/glsl/glsl_parser_extras.cpp
> @@ -721,6 +721,7 @@ static const _mesa_glsl_extension _mesa_glsl_supported_extensions[] = {
>     EXT(EXT_separate_shader_objects),
>     EXT(EXT_shader_framebuffer_fetch),
>     EXT(EXT_shader_framebuffer_fetch_non_coherent),
> +   EXT(EXT_shader_image_load_formatted),
>     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 b17b5125e0..63a5cca5d2 100644
> --- a/src/compiler/glsl/glsl_parser_extras.h
> +++ b/src/compiler/glsl/glsl_parser_extras.h
> @@ -344,6 +344,11 @@ struct _mesa_glsl_parse_state {
>        return ARB_bindless_texture_enable;
>     }
>
> +   bool has_image_load_formatted() const
> +   {
> +      return EXT_shader_image_load_formatted_enable;
> +   }
> +
>     bool has_implicit_conversions() const
>     {
>        return EXT_shader_implicit_conversions_enable || is_version(120, 0);
> @@ -816,6 +821,8 @@ struct _mesa_glsl_parse_state {
>     bool EXT_shader_framebuffer_fetch_warn;
>     bool EXT_shader_framebuffer_fetch_non_coherent_enable;
>     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_implicit_conversions_enable;
>     bool EXT_shader_implicit_conversions_warn;
>     bool EXT_shader_integer_mix_enable;
> diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
> index dad38124d5..c3eb019f81 100644
> --- a/src/mesa/main/extensions_table.h
> +++ b/src/mesa/main/extensions_table.h
> @@ -264,6 +264,7 @@ EXT(EXT_separate_shader_objects             , dummy_true
>  EXT(EXT_separate_specular_color             , dummy_true                             , GLL,  x ,  x ,  x , 1997)
>  EXT(EXT_shader_framebuffer_fetch            , EXT_shader_framebuffer_fetch           , GLL, GLC,  x , ES2, 2013)
>  EXT(EXT_shader_framebuffer_fetch_non_coherent, EXT_shader_framebuffer_fetch_non_coherent, GLL, GLC,  x, ES2, 2018)
> +EXT(EXT_shader_image_load_formatted         , EXT_shader_image_load_formatted        , GLL, GLC,  x ,  x , 2014)
>  EXT(EXT_shader_implicit_conversions         , dummy_true                             ,  x ,  x ,  x ,  31, 2013)
>  EXT(EXT_shader_integer_mix                  , EXT_shader_integer_mix                 , GLL, GLC,  x ,  30, 2013)
>  EXT(EXT_shader_io_blocks                    , dummy_true                             ,  x ,  x ,  x ,  31, 2014)
> diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
> index 241c2b92f7..bd90727e26 100644
> --- a/src/mesa/main/mtypes.h
> +++ b/src/mesa/main/mtypes.h
> @@ -4264,6 +4264,7 @@ struct gl_extensions
>     GLboolean EXT_render_snorm;
>     GLboolean EXT_semaphore;
>     GLboolean EXT_semaphore_fd;
> +   GLboolean EXT_shader_image_load_formatted;
>     GLboolean EXT_shader_integer_mix;
>     GLboolean EXT_shader_samples_identical;
>     GLboolean EXT_stencil_two_side;
> --
> 2.20.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list