From: Ian Romanick Date: Thu, 10 May 2007 04:46:43 +0000 (-0700) Subject: Refactor the way TestProxyTexImage is called in texture_error_check. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e2e4b60c7d9fc3618c0f9d7496c9ce3d5eee3ab5;p=mesa.git Refactor the way TestProxyTexImage is called in texture_error_check. --- diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 706d3466955..9fb430f39b4 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1329,8 +1329,9 @@ texture_error_check( GLcontext *ctx, GLenum target, GLint depth, GLint border ) { const GLboolean isProxy = _mesa_is_proxy_texture(target); - GLboolean sizeOK; + GLboolean sizeOK = GL_TRUE; GLboolean colorFormat, indexFormat; + GLenum proxy_target; /* Basic level check (more checking in ctx->Driver.TestProxyTexImage) */ if (level < 0 || level >= MAX_TEXTURE_LEVELS) { @@ -1365,10 +1366,9 @@ texture_error_check( GLcontext *ctx, GLenum target, */ if (dimensions == 1) { if (target == GL_PROXY_TEXTURE_1D || target == GL_TEXTURE_1D) { - sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_1D, - level, internalFormat, - format, type, - width, 1, 1, border); + proxy_target = GL_PROXY_TEXTURE_1D; + height = 1; + width = 1; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage1D(target)" ); @@ -1376,11 +1376,9 @@ texture_error_check( GLcontext *ctx, GLenum target, } } else if (dimensions == 2) { + depth = 1; if (target == GL_PROXY_TEXTURE_2D || target == GL_TEXTURE_2D) { - sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_2D, - level, internalFormat, - format, type, - width, height, 1, border); + proxy_target = GL_PROXY_TEXTURE_2D; } else if (target == GL_PROXY_TEXTURE_CUBE_MAP_ARB || (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB && @@ -1389,10 +1387,8 @@ texture_error_check( GLcontext *ctx, GLenum target, _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); return GL_TRUE; } - sizeOK = (width == height) && - ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_CUBE_MAP_ARB, - level, internalFormat, format, type, - width, height, 1, border); + proxy_target = GL_PROXY_TEXTURE_CUBE_MAP_ARB; + sizeOK = (width == height); } else if (target == GL_PROXY_TEXTURE_RECTANGLE_NV || target == GL_TEXTURE_RECTANGLE_NV) { @@ -1400,11 +1396,7 @@ texture_error_check( GLcontext *ctx, GLenum target, _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); return GL_TRUE; } - sizeOK = ctx->Driver.TestProxyTexImage(ctx, - GL_PROXY_TEXTURE_RECTANGLE_NV, - level, internalFormat, - format, type, - width, height, 1, border); + proxy_target = GL_PROXY_TEXTURE_RECTANGLE_NV; } else { _mesa_error(ctx, GL_INVALID_ENUM, "glTexImage2D(target)"); @@ -1413,10 +1405,7 @@ texture_error_check( GLcontext *ctx, GLenum target, } else if (dimensions == 3) { if (target == GL_PROXY_TEXTURE_3D || target == GL_TEXTURE_3D) { - sizeOK = ctx->Driver.TestProxyTexImage(ctx, GL_PROXY_TEXTURE_3D, - level, internalFormat, - format, type, - width, height, depth, border); + proxy_target = GL_PROXY_TEXTURE_3D; } else { _mesa_error( ctx, GL_INVALID_ENUM, "glTexImage3D(target)" ); @@ -1428,6 +1417,10 @@ texture_error_check( GLcontext *ctx, GLenum target, return GL_TRUE; } + sizeOK = sizeOK && ctx->Driver.TestProxyTexImage(ctx, proxy_target, level, + internalFormat, format, + type, width, height, + depth, border); if (!sizeOK) { if (!isProxy) { _mesa_error(ctx, GL_INVALID_VALUE,