[Mesa-dev] [PATCH v3] mesa/es3.1: enable ARB_shader_atomic_counters for GLES 3.1

Ilia Mirkin imirkin at alum.mit.edu
Tue May 12 07:31:06 PDT 2015


Not all contexts have geometry shaders. For example, ES 3.1 doesn't
have them. Or a pre-3.2 GL context. This needs to be checked for
MAX_GEOMETRY_ATOMIC_COUNTERS and the other one.

On Tue, May 12, 2015 at 10:29 AM, Marta Lofstedt
<marta.lofstedt at linux.intel.com> wrote:
> From: Marta Lofstedt <marta.lofstedt at intel.com>
>
> v3: only expose ARB_shader_atomic_counters enums
> for gles 3.1 and GL core and remove functionality
> related to obsolete:
> extra_ARB_shader_atomic_counters_and_geometry_shader.
>
> Signed-off-by: Marta Lofstedt <marta.lofstedt at intel.com>
> ---
>  src/mesa/main/get.c              | 17 ++++++-----------
>  src/mesa/main/get_hash_params.py | 25 ++++++++++++-------------
>  2 files changed, 18 insertions(+), 24 deletions(-)
>
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 73739b6..96fdfa3 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -147,7 +147,6 @@ enum value_extra {
>     EXTRA_FLUSH_CURRENT,
>     EXTRA_GLSL_130,
>     EXTRA_EXT_UBO_GS4,
> -   EXTRA_EXT_ATOMICS_GS4,
>     EXTRA_EXT_SHADER_IMAGE_GS4,
>  };
>
> @@ -339,11 +338,6 @@ static const int extra_EXT_texture_array_es3[] = {
>     EXTRA_END
>  };
>
> -static const int extra_ARB_shader_atomic_counters_and_geometry_shader[] = {
> -   EXTRA_EXT_ATOMICS_GS4,
> -   EXTRA_END
> -};
> -
>  static const int extra_ARB_shader_image_load_store_and_geometry_shader[] = {
>     EXTRA_EXT_SHADER_IMAGE_GS4,
>     EXTRA_END
> @@ -361,6 +355,12 @@ static const int extra_ARB_shader_image_load_store_es31[] = {
>     EXTRA_END
>  };
>
> +static const int extra_ARB_shader_atomic_counters_es31[] = {
> +   EXT(ARB_shader_atomic_counters),
> +   EXTRA_API_ES31,
> +   EXTRA_END
> +};
> +
>  EXTRA_EXT(ARB_texture_cube_map);
>  EXTRA_EXT(EXT_texture_array);
>  EXTRA_EXT(NV_fog_distance);
> @@ -1144,11 +1144,6 @@ check_extra(struct gl_context *ctx, const char *func, const struct value_desc *d
>           api_found = (ctx->Extensions.ARB_uniform_buffer_object &&
>                        _mesa_has_geometry_shaders(ctx));
>           break;
> -      case EXTRA_EXT_ATOMICS_GS4:
> -         api_check = GL_TRUE;
> -         api_found = (ctx->Extensions.ARB_shader_atomic_counters &&
> -                      _mesa_has_geometry_shaders(ctx));
> -         break;
>        case EXTRA_EXT_SHADER_IMAGE_GS4:
>           api_check = GL_TRUE;
>           api_found = (ctx->Extensions.ARB_shader_image_load_store &&
> diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
> index 85c2494..bf843d9 100644
> --- a/src/mesa/main/get_hash_params.py
> +++ b/src/mesa/main/get_hash_params.py
> @@ -421,6 +421,18 @@ descriptor=[
>    [ "MAX_GEOMETRY_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxImageUniforms), extra_ARB_shader_image_load_store_es31"],
>    [ "MAX_FRAGMENT_IMAGE_UNIFORMS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxImageUniforms), extra_ARB_shader_image_load_store_es31"],
>    [ "MAX_COMBINED_IMAGE_UNIFORMS", "CONTEXT_INT(Const.MaxCombinedImageUniforms), extra_ARB_shader_image_load_store_es31"],
> +# GL_ARB_shader_atomic_counters / GLES 3.1
> +  [ "ATOMIC_COUNTER_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_ATOMIC_COUNTER_BUFFER_BINDINGS", "CONTEXT_INT(Const.MaxAtomicBufferBindings), extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_ATOMIC_COUNTER_BUFFER_SIZE", "CONTEXT_INT(Const.MaxAtomicBufferSize), extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_VERTEX_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers), extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_VERTEX_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters), extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers), extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_FRAGMENT_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters), extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers), extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_GEOMETRY_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters), extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_COMBINED_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.MaxCombinedAtomicBuffers), extra_ARB_shader_atomic_counters_es31" ],
> +  [ "MAX_COMBINED_ATOMIC_COUNTERS", "CONTEXT_INT(Const.MaxCombinedAtomicCounters), extra_ARB_shader_atomic_counters_es31" ],
>  ]},
>
>  # Remaining enums are only in OpenGL
> @@ -771,19 +783,6 @@ descriptor=[
>  # GL_ARB_separate_shader_objects
>    [ "PROGRAM_PIPELINE_BINDING", "LOC_CUSTOM, TYPE_INT, GL_PROGRAM_PIPELINE_BINDING, NO_EXTRA" ],
>
> -# GL_ARB_shader_atomic_counters
> -  [ "ATOMIC_COUNTER_BUFFER_BINDING", "LOC_CUSTOM, TYPE_INT, 0, extra_ARB_shader_atomic_counters" ],
> -  [ "MAX_ATOMIC_COUNTER_BUFFER_BINDINGS", "CONTEXT_INT(Const.MaxAtomicBufferBindings), extra_ARB_shader_atomic_counters" ],
> -  [ "MAX_ATOMIC_COUNTER_BUFFER_SIZE", "CONTEXT_INT(Const.MaxAtomicBufferSize), extra_ARB_shader_atomic_counters" ],
> -  [ "MAX_VERTEX_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAtomicBuffers), extra_ARB_shader_atomic_counters" ],
> -  [ "MAX_VERTEX_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_VERTEX].MaxAtomicCounters), extra_ARB_shader_atomic_counters" ],
> -  [ "MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicBuffers), extra_ARB_shader_atomic_counters" ],
> -  [ "MAX_FRAGMENT_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_FRAGMENT].MaxAtomicCounters), extra_ARB_shader_atomic_counters" ],
> -  [ "MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicBuffers), extra_ARB_shader_atomic_counters_and_geometry_shader" ],
> -  [ "MAX_GEOMETRY_ATOMIC_COUNTERS", "CONTEXT_INT(Const.Program[MESA_SHADER_GEOMETRY].MaxAtomicCounters), extra_ARB_shader_atomic_counters_and_geometry_shader" ],
> -  [ "MAX_COMBINED_ATOMIC_COUNTER_BUFFERS", "CONTEXT_INT(Const.MaxCombinedAtomicBuffers), extra_ARB_shader_atomic_counters" ],
> -  [ "MAX_COMBINED_ATOMIC_COUNTERS", "CONTEXT_INT(Const.MaxCombinedAtomicCounters), extra_ARB_shader_atomic_counters" ],
> -
>  # GL_ARB_vertex_attrib_binding
>    [ "MAX_VERTEX_ATTRIB_RELATIVE_OFFSET", "CONTEXT_ENUM(Const.MaxVertexAttribRelativeOffset), NO_EXTRA" ],
>    [ "MAX_VERTEX_ATTRIB_BINDINGS", "CONTEXT_ENUM(Const.MaxVertexAttribBindings), NO_EXTRA" ],
> --
> 1.9.1
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list