summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2016-08-18 11:11:04 +0100
committerIan Romanick <[email protected]>2016-08-26 15:03:15 -0700
commit87fa462ffd6754144f89163a2692eff005beef9c (patch)
tree8563fe5124dcd47b2da3c8308b77c791e6c5592f
parent66b988d09af1a505b428cf2a32c7ee11fb832982 (diff)
mesa: Add and use _mesa_has_texture_cube_map_array helper
Signed-off-by: Ian Romanick <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
-rw-r--r--src/mesa/main/context.h5
-rw-r--r--src/mesa/main/teximage.c12
-rw-r--r--src/mesa/main/texobj.c4
3 files changed, 13 insertions, 8 deletions
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