[Mesa-dev] [PATCH 13/17] mesa: Add and use _mesa_has_texture_cube_map_array helper

Ilia Mirkin imirkin at alum.mit.edu
Wed Aug 24 22:51:23 UTC 2016


On Wed, Aug 24, 2016 at 6:12 PM, Ian Romanick <idr at freedesktop.org> wrote:
> From: Ian Romanick <ian.d.romanick at intel.com>
>
> Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
> ---
>  src/mesa/main/context.h  |  5 +++++
>  src/mesa/main/teximage.c | 12 ++++++------
>  src/mesa/main/texobj.c   |  4 ++--
>  3 files changed, 13 insertions(+), 8 deletions(-)
>
> diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
> index 9a609dd..9100ae7 100644
> --- a/src/mesa/main/context.h
> +++ b/src/mesa/main/context.h
> @@ -351,6 +351,11 @@ _mesa_has_tessellation(const struct gl_context *ctx)
>            _mesa_has_ARB_tessellation_shader(ctx);
>  }
>
> +static inline bool
> +_mesa_has_texture_cube_map_array(const struct gl_context *ctx)
> +{
> +   return _mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_cube_map_array;

Should this be

return _mesa_has_ARB_texture_cube_map_array(ctx); ? [I realize those
are largely identical, but you moved towards using the helper in
previous patches.]

> +}
>
>  #ifdef __cplusplus
>  }
> diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
> index 8869b3d..61d975d 100644
> --- a/src/mesa/main/teximage.c
> +++ b/src/mesa/main/teximage.c
> @@ -502,7 +502,7 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target)
>           ? ctx->Const.MaxTextureLevels : 0;
>     case GL_TEXTURE_CUBE_MAP_ARRAY:
>     case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
> -      return ctx->Extensions.ARB_texture_cube_map_array
> +      return _mesa_has_texture_cube_map_array(ctx)
>           ? ctx->Const.MaxCubeTextureLevels : 0;
>     case GL_TEXTURE_BUFFER:
>        return (_mesa_has_ARB_texture_buffer_object(ctx) ||
> @@ -1433,7 +1433,7 @@ _mesa_target_can_be_compressed(const struct gl_context *ctx, GLenum target,
>         */
>        if (layout == MESA_FORMAT_LAYOUT_ETC2 && _mesa_is_gles3(ctx))
>              return write_error(error, GL_INVALID_OPERATION);
> -      target_can_be_compresed = ctx->Extensions.ARB_texture_cube_map_array;
> +      target_can_be_compresed = _mesa_has_texture_cube_map_array(ctx);
>        break;
>     case GL_TEXTURE_3D:
>        switch (layout) {
> @@ -1523,7 +1523,7 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target)
>           return _mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_array;
>        case GL_TEXTURE_CUBE_MAP_ARRAY:
>        case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
> -         return ctx->Extensions.ARB_texture_cube_map_array;
> +         return _mesa_has_texture_cube_map_array(ctx);
>        default:
>           return GL_FALSE;
>        }
> @@ -1575,7 +1575,7 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target,
>              || _mesa_is_gles3(ctx);
>        case GL_TEXTURE_CUBE_MAP_ARRAY:
>        case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
> -         return ctx->Extensions.ARB_texture_cube_map_array;
> +         return _mesa_has_texture_cube_map_array(ctx);
>
>        /* Table 8.15 of the OpenGL 4.5 core profile spec
>         * (20141030) says that TEXTURE_CUBE_MAP is valid for TextureSubImage3D
> @@ -1673,7 +1673,7 @@ _mesa_legal_texture_base_format_for_target(struct gl_context *ctx,
>              || (ctx->API == API_OPENGLES2 && ctx->Extensions.OES_depth_texture_cube_map))) &&
>            !((target == GL_TEXTURE_CUBE_MAP_ARRAY ||
>               target == GL_PROXY_TEXTURE_CUBE_MAP_ARRAY) &&
> -            ctx->Extensions.ARB_texture_cube_map_array)) {
> +            _mesa_has_texture_cube_map_array(ctx))) {
>           return false;
>        }
>     }
> @@ -4317,7 +4317,7 @@ compressed_subtexture_target_check(struct gl_context *ctx, GLenum target,
>              (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_texture_array);
>           break;
>        case GL_TEXTURE_CUBE_MAP_ARRAY:
> -         targetOK = ctx->Extensions.ARB_texture_cube_map_array;
> +         targetOK = _mesa_has_texture_cube_map_array(ctx);
>           break;
>        case GL_TEXTURE_3D:
>           targetOK = GL_TRUE;
> diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
> index b48a980..655627b 100644
> --- a/src/mesa/main/texobj.c
> +++ b/src/mesa/main/texobj.c
> @@ -184,10 +184,10 @@ _mesa_get_current_tex_object(struct gl_context *ctx, GLenum target)
>           return ctx->Extensions.ARB_texture_cube_map
>                  ? ctx->Texture.ProxyTex[TEXTURE_CUBE_INDEX] : NULL;
>        case GL_TEXTURE_CUBE_MAP_ARRAY:
> -         return ctx->Extensions.ARB_texture_cube_map_array
> +         return _mesa_has_texture_cube_map_array(ctx)
>                  ? texUnit->CurrentTex[TEXTURE_CUBE_ARRAY_INDEX] : NULL;
>        case GL_PROXY_TEXTURE_CUBE_MAP_ARRAY:
> -         return ctx->Extensions.ARB_texture_cube_map_array
> +         return _mesa_has_texture_cube_map_array(ctx)
>                  ? ctx->Texture.ProxyTex[TEXTURE_CUBE_ARRAY_INDEX] : NULL;
>        case GL_TEXTURE_RECTANGLE_NV:
>           return ctx->Extensions.NV_texture_rectangle
> --
> 2.5.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