From 87fa462ffd6754144f89163a2692eff005beef9c Mon Sep 17 00:00:00 2001 From: Ian Romanick Date: Thu, 18 Aug 2016 11:11:04 +0100 Subject: mesa: Add and use _mesa_has_texture_cube_map_array helper Signed-off-by: Ian Romanick Reviewed-by: Ilia Mirkin Reviewed-by: Kenneth Graunke --- 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(-) (limited to 'src/mesa') diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index 9a609dd61ff..9100ae75cdc 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; +} #ifdef __cplusplus } diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index efde1140126..3f3d4307235 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 b48a980dc17..655627b92c3 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 -- cgit v1.2.3