[Mesa-dev] [PATCH 23/25] glsl: Implement the required built-in functions when OES_shader_image_atomic is enabled.

Matt Turner mattst88 at gmail.com
Mon Aug 17 10:14:37 PDT 2015


On Mon, Aug 17, 2015 at 9:46 AM, Francisco Jerez <currojerez at riseup.net> wrote:
> This is basically just the same atomic functions exposed by
> ARB_shader_image_load_store, with one exception:
>
>     "highp float imageAtomicExchange(
>          coherent IMAGE_PARAMS,
>          float data);"
>
> There's no float atomic exchange overload in the original
> ARB_shader_image_load_store or GL 4.2, so this seems like new
> functionality that requires specific back-end support and a separate
> availability condition in the built-in function generator.
> ---
>  src/glsl/builtin_functions.cpp | 25 ++++++++++++++++++++-----
>  1 file changed, 20 insertions(+), 5 deletions(-)
>
> diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
> index c53858e..444d0ee 100644
> --- a/src/glsl/builtin_functions.cpp
> +++ b/src/glsl/builtin_functions.cpp
> @@ -401,8 +401,16 @@ shader_image_load_store(const _mesa_glsl_parse_state *state)
>  static bool
>  shader_image_atomic(const _mesa_glsl_parse_state *state)
>  {
> -   return (state->is_version(420, 0) ||
> -           state->ARB_shader_image_load_store_enable);
> +   return (state->is_version(420, 320) ||
> +           state->ARB_shader_image_load_store_enable ||
> +           state->OES_shader_image_atomic_enable);
> +}
> +
> +static bool
> +shader_image_atomic_exchange_float(const _mesa_glsl_parse_state *state)
> +{
> +   return (state->is_version(450, 320) ||
> +           state->OES_shader_image_atomic_enable);
>  }
>
>  static bool
> @@ -506,7 +514,8 @@ private:
>        IMAGE_FUNCTION_SUPPORTS_FLOAT_DATA_TYPE = (1 << 3),
>        IMAGE_FUNCTION_READ_ONLY = (1 << 4),
>        IMAGE_FUNCTION_WRITE_ONLY = (1 << 5),
> -      IMAGE_FUNCTION_AVAIL_ATOMIC = (1 << 6)
> +      IMAGE_FUNCTION_AVAIL_ATOMIC = (1 << 6),
> +      IMAGE_FUNCTION_AVAIL_ATOMIC_EXCHANGE = (1 << 7)

I wonder if MSVC is okay with a trailing comma here?


More information about the mesa-dev mailing list