From 38d3f3d660225150715bc06f6b33e394ba803299 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Thu, 7 Sep 2000 15:38:49 +0000 Subject: [PATCH] added device driver function for texture proxy testing --- src/mesa/main/dd.h | 14 ++++++-- src/mesa/main/teximage.c | 69 ++++++++++++++++++++++++++++++---------- 2 files changed, 64 insertions(+), 19 deletions(-) diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index fce30099d35..d37eac3d1f8 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -1,8 +1,8 @@ -/* $Id: dd.h,v 1.28 2000/08/29 23:31:23 brianp Exp $ */ +/* $Id: dd.h,v 1.29 2000/09/07 15:38:49 brianp Exp $ */ /* * Mesa 3-D graphics library - * Version: 3.4 + * Version: 3.5 * * Copyright (C) 1999-2000 Brian Paul All Rights Reserved. * @@ -641,6 +641,16 @@ struct dd_function_table { * Core Mesa will perform any image format/type conversions that are needed. */ + GLboolean (*TestProxyTexImage)(GLcontext *ctx, GLenum target, + GLint level, GLint internalFormat, + GLenum format, GLenum type, + GLint width, GLint height, + GLint depth, GLint border); + /* Called by glTexImage[123]D when user specifies a proxy texture + * target. Return GL_TRUE if the proxy test passes, return GL_FALSE + * if the test fails. + */ + GLboolean (*CompressedTexImage1D)( GLcontext *ctx, GLenum target, GLint level, GLsizei imageSize, const GLvoid *data, diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index b24344d85cd..6f14c1974bf 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -1,4 +1,4 @@ -/* $Id: teximage.c,v 1.49 2000/09/06 15:15:43 brianp Exp $ */ +/* $Id: teximage.c,v 1.50 2000/09/07 15:38:49 brianp Exp $ */ /* * Mesa 3-D graphics library @@ -1701,10 +1701,16 @@ _mesa_TexImage1D( GLenum target, GLint level, GLint internalFormat, gl_put_texobj_on_dirty_list( ctx, texObj ); ctx->NewState |= NEW_TEXTURING; } - else if (target==GL_PROXY_TEXTURE_1D) { + else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check(ctx, target, level, internalFormat, - format, type, 1, postConvWidth, 1, 1, border)) { + GLenum error = texture_error_check(ctx, target, level, internalFormat, + format, type, 1, width, 1, 1, border); + if (!error && ctx->Driver.TestProxyTexImage) { + error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, + internalFormat, format, type, + width, 1, 1, border); + } + if (error) { /* if error, clear all proxy texture image parameters */ if (level>=0 && levelConst.MaxTextureLevels) { clear_proxy_teximage(ctx->Texture.Proxy1D->Image[level]); @@ -1840,10 +1846,16 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, gl_put_texobj_on_dirty_list( ctx, texObj ); ctx->NewState |= NEW_TEXTURING; } - else if (target==GL_PROXY_TEXTURE_2D) { + else if (target == GL_PROXY_TEXTURE_2D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check(ctx, target, level, internalFormat, - format, type, 2, postConvWidth, height, 1, border)) { + GLenum error = texture_error_check(ctx, target, level, internalFormat, + format, type, 2, width, height, 1, border); + if (!error && ctx->Driver.TestProxyTexImage) { + error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, + internalFormat, format, type, + width, height, 1, border); + } + if (error) { /* if error, clear all proxy texture image parameters */ if (level>=0 && levelConst.MaxTextureLevels) { clear_proxy_teximage(ctx->Texture.Proxy2D->Image[level]); @@ -1863,7 +1875,6 @@ _mesa_TexImage2D( GLenum target, GLint level, GLint internalFormat, } - /* * Called by the API or display list executor. * Note that width and height include the border. @@ -1966,10 +1977,16 @@ _mesa_TexImage3D( GLenum target, GLint level, GLint internalFormat, gl_put_texobj_on_dirty_list( ctx, texObj ); ctx->NewState |= NEW_TEXTURING; } - else if (target==GL_PROXY_TEXTURE_3D) { + else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check(ctx, target, level, internalFormat, - format, type, 3, width, height, depth, border)) { + GLenum error = texture_error_check(ctx, target, level, internalFormat, + format, type, 3, width, height, depth, border); + if (!error && ctx->Driver.TestProxyTexImage) { + error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, + internalFormat, format, type, + width, height, depth, border); + } + if (error) { /* if error, clear all proxy texture image parameters */ if (level>=0 && levelConst.MaxTextureLevels) { clear_proxy_teximage(ctx->Texture.Proxy3D->Image[level]); @@ -2904,8 +2921,14 @@ _mesa_CompressedTexImage1DARB(GLenum target, GLint level, } else if (target == GL_PROXY_TEXTURE_1D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 1, width, 1, 1, border)) { + GLenum error = texture_error_check(ctx, target, level, internalFormat, + GL_NONE, GL_NONE, 1, width, 1, 1, border); + if (!error && ctx->Driver.TestProxyTexImage) { + error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, + internalFormat, GL_NONE, GL_NONE, + width, 1, 1, border); + } + if (error) { /* if error, clear all proxy texture image parameters */ if (level>=0 && levelConst.MaxTextureLevels) { clear_proxy_teximage(ctx->Texture.Proxy1D->Image[level]); @@ -3033,8 +3056,14 @@ _mesa_CompressedTexImage2DARB(GLenum target, GLint level, } else if (target == GL_PROXY_TEXTURE_2D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 1, width, 1, 1, border)) { + GLenum error = texture_error_check(ctx, target, level, internalFormat, + GL_NONE, GL_NONE, 2, width, height, 1, border); + if (!error && ctx->Driver.TestProxyTexImage) { + error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, + internalFormat, GL_NONE, GL_NONE, + width, height, 1, border); + } + if (error) { /* if error, clear all proxy texture image parameters */ if (level>=0 && levelConst.MaxTextureLevels) { clear_proxy_teximage(ctx->Texture.Proxy2D->Image[level]); @@ -3156,8 +3185,14 @@ _mesa_CompressedTexImage3DARB(GLenum target, GLint level, } else if (target == GL_PROXY_TEXTURE_3D) { /* Proxy texture: check for errors and update proxy state */ - if (texture_error_check(ctx, target, level, internalFormat, - GL_NONE, GL_NONE, 1, width, height, depth, border)) { + GLenum error = texture_error_check(ctx, target, level, internalFormat, + GL_NONE, GL_NONE, 1, width, height, depth, border); + if (!error && ctx->Driver.TestProxyTexImage) { + error = !(*ctx->Driver.TestProxyTexImage)(ctx, target, level, + internalFormat, GL_NONE, GL_NONE, + width, height, depth, border); + } + if (error) { /* if error, clear all proxy texture image parameters */ if (level>=0 && levelConst.MaxTextureLevels) { clear_proxy_teximage(ctx->Texture.Proxy3D->Image[level]); -- 2.30.2