[Mesa-dev] [PATCH 2/3] mesa: Add and use _mesa_has_texture_view helper(v2)
Ilia Mirkin
imirkin at alum.mit.edu
Tue Aug 30 23:39:19 UTC 2016
On Mon, Aug 29, 2016 at 1:25 AM, Francesco Ansanelli
<francians at gmail.com> wrote:
> V2:use the same tokens of the desktop version
> (Ilia Mirkin, Chris Forbes)
>
> Signed-off-by: Francesco Ansanelli <francians at gmail.com>
> ---
> src/mesa/main/context.h | 7 +++++++
> src/mesa/main/texparam.c | 22 ++++++++++------------
> 2 files changed, 17 insertions(+), 12 deletions(-)
>
> diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
> index 4cd149d..bdf4414 100644
> --- a/src/mesa/main/context.h
> +++ b/src/mesa/main/context.h
> @@ -358,6 +358,13 @@ _mesa_has_texture_cube_map_array(const struct gl_context *ctx)
> _mesa_has_OES_texture_cube_map_array(ctx);
> }
>
> +static inline bool
> +_mesa_has_texture_view(const struct gl_context *ctx)
> +{
> + return _mesa_has_OES_texture_view(ctx) ||
> + (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view);
I think you just want || _mesa_has_ARB_texture_view(ctx).
> +}
> +
> #ifdef __cplusplus
> }
> #endif
> diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
> index bdd3fcb..2c99804 100644
> --- a/src/mesa/main/texparam.c
> +++ b/src/mesa/main/texparam.c
> @@ -1929,33 +1929,32 @@ get_tex_parameterfv(struct gl_context *ctx,
> break;
>
> case GL_TEXTURE_IMMUTABLE_LEVELS:
> - if (_mesa_is_gles3(ctx) ||
> - (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
> + if (_mesa_is_gles3(ctx) || _mesa_has_texture_view(ctx))
> *params = (GLfloat) obj->ImmutableLevels;
> else
> goto invalid_pname;
> break;
>
> case GL_TEXTURE_VIEW_MIN_LEVEL:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
> goto invalid_pname;
> *params = (GLfloat) obj->MinLevel;
> break;
>
> case GL_TEXTURE_VIEW_NUM_LEVELS:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
> goto invalid_pname;
> *params = (GLfloat) obj->NumLevels;
> break;
>
> case GL_TEXTURE_VIEW_MIN_LAYER:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
> goto invalid_pname;
> *params = (GLfloat) obj->MinLayer;
> break;
>
> case GL_TEXTURE_VIEW_NUM_LAYERS:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
> goto invalid_pname;
> *params = (GLfloat) obj->NumLayers;
> break;
> @@ -2161,33 +2160,32 @@ get_tex_parameteriv(struct gl_context *ctx,
> break;
>
> case GL_TEXTURE_IMMUTABLE_LEVELS:
> - if (_mesa_is_gles3(ctx) ||
> - (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_view))
> + if (_mesa_is_gles3(ctx) || _mesa_has_texture_view(ctx))
> *params = obj->ImmutableLevels;
> else
> goto invalid_pname;
> break;
>
> case GL_TEXTURE_VIEW_MIN_LEVEL:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
> goto invalid_pname;
> *params = (GLint) obj->MinLevel;
> break;
>
> case GL_TEXTURE_VIEW_NUM_LEVELS:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
> goto invalid_pname;
> *params = (GLint) obj->NumLevels;
> break;
>
> case GL_TEXTURE_VIEW_MIN_LAYER:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
> goto invalid_pname;
> *params = (GLint) obj->MinLayer;
> break;
>
> case GL_TEXTURE_VIEW_NUM_LAYERS:
> - if (!ctx->Extensions.ARB_texture_view)
> + if (!_mesa_has_texture_view(ctx))
> goto invalid_pname;
> *params = (GLint) obj->NumLayers;
> break;
> --
> 1.7.9.5
>
> _______________________________________________
> 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