From: Brian Paul Date: Wed, 26 Jan 2011 01:07:45 +0000 (-0700) Subject: mesa: add checks for GL_EXT_texture_array X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f2dd11817a66b6254e1533398dc53f1bc51953be;p=mesa.git mesa: add checks for GL_EXT_texture_array In case the driver enables GL_MESA_texture_array but not the EXT version. --- diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index c3cd6b66ae6..7f630e23c7a 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -703,6 +703,9 @@ _mesa_select_tex_object(struct gl_context *ctx, const struct gl_texture_unit *texUnit, GLenum target) { + const GLboolean arrayTex = (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); + switch (target) { case GL_TEXTURE_1D: return texUnit->CurrentTex[TEXTURE_1D_INDEX]; @@ -735,17 +738,13 @@ _mesa_select_tex_object(struct gl_context *ctx, return ctx->Extensions.NV_texture_rectangle ? ctx->Texture.ProxyTex[TEXTURE_RECT_INDEX] : NULL; case GL_TEXTURE_1D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array - ? texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX] : NULL; + return arrayTex ? texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX] : NULL; case GL_PROXY_TEXTURE_1D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array - ? ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX] : NULL; + return arrayTex ? ctx->Texture.ProxyTex[TEXTURE_1D_ARRAY_INDEX] : NULL; case GL_TEXTURE_2D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array - ? texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX] : NULL; + return arrayTex ? texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX] : NULL; case GL_PROXY_TEXTURE_2D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array - ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL; + return arrayTex ? ctx->Texture.ProxyTex[TEXTURE_2D_ARRAY_INDEX] : NULL; default: _mesa_problem(NULL, "bad target in _mesa_select_tex_object()"); return NULL; @@ -930,7 +929,8 @@ _mesa_max_texture_levels(struct gl_context *ctx, GLenum target) case GL_PROXY_TEXTURE_1D_ARRAY_EXT: case GL_TEXTURE_2D_ARRAY_EXT: case GL_PROXY_TEXTURE_2D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array) ? ctx->Const.MaxTextureLevels : 0; default: return 0; /* bad target */ @@ -1382,7 +1382,8 @@ target_can_be_compressed(const struct gl_context *ctx, GLenum target, return ctx->Extensions.ARB_texture_cube_map; case GL_PROXY_TEXTURE_2D_ARRAY_EXT: case GL_TEXTURE_2D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array; + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.MESA_texture_array); default: return GL_FALSE; } @@ -1423,7 +1424,8 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target) return ctx->Extensions.NV_texture_rectangle; case GL_TEXTURE_1D_ARRAY_EXT: case GL_PROXY_TEXTURE_1D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array; + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); default: return GL_FALSE; } @@ -1434,7 +1436,8 @@ legal_teximage_target(struct gl_context *ctx, GLuint dims, GLenum target) return GL_TRUE; case GL_TEXTURE_2D_ARRAY_EXT: case GL_PROXY_TEXTURE_2D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array; + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); default: return GL_FALSE; } @@ -1471,7 +1474,8 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target) case GL_TEXTURE_RECTANGLE_NV: return ctx->Extensions.NV_texture_rectangle; case GL_TEXTURE_1D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array; + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); default: return GL_FALSE; } @@ -1480,7 +1484,8 @@ legal_texsubimage_target(struct gl_context *ctx, GLuint dims, GLenum target) case GL_TEXTURE_3D: return GL_TRUE; case GL_TEXTURE_2D_ARRAY_EXT: - return ctx->Extensions.MESA_texture_array; + return (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array); default: return GL_FALSE; } diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index 4909b76cb76..62922f3ac99 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -116,12 +116,14 @@ get_texobj(struct gl_context *ctx, GLenum target, GLboolean get) } break; case GL_TEXTURE_1D_ARRAY_EXT: - if (ctx->Extensions.MESA_texture_array) { + if (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array) { return texUnit->CurrentTex[TEXTURE_1D_ARRAY_INDEX]; } break; case GL_TEXTURE_2D_ARRAY_EXT: - if (ctx->Extensions.MESA_texture_array) { + if (ctx->Extensions.MESA_texture_array || + ctx->Extensions.EXT_texture_array) { return texUnit->CurrentTex[TEXTURE_2D_ARRAY_INDEX]; } break;