summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgareth <gareth>2001-03-05 15:13:07 +0000
committergareth <gareth>2001-03-05 15:13:07 +0000
commit47ce3d793861aa97174f79c7ecd8cf137d6d4640 (patch)
tree54040c2d125899b1d6178bd3608791fa18c923bd
parenta25b52adcd8c430d9b94158f75a815b38ef19a16 (diff)
- Fix Radeon subimage updatestdfx-3-1-0-20010305-freeze
- Change the behaviour of t->bound in Radeon driver.
-rw-r--r--xc/extras/Mesa/src/teximage.h4
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c6
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c47
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c7
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h3
-rw-r--r--xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c17
-rw-r--r--xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c2
7 files changed, 52 insertions, 34 deletions
diff --git a/xc/extras/Mesa/src/teximage.h b/xc/extras/Mesa/src/teximage.h
index 566294d5e..45ce79a1b 100644
--- a/xc/extras/Mesa/src/teximage.h
+++ b/xc/extras/Mesa/src/teximage.h
@@ -34,6 +34,10 @@
/*** Internal functions ***/
+extern GLint
+_mesa_base_tex_format( GLcontext *ctx, GLint format );
+
+
extern struct gl_texture_image *
_mesa_alloc_texture_image( void );
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c
index c56c54ffc..c2cd6a203 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_ioctl.c
@@ -618,12 +618,6 @@ static GLbitfield radeonDDClear( GLcontext *ctx, GLbitfield mask,
}
#endif
-#if 0
- if ( rmesa->dirty & ~RADEON_UPLOAD_CLIPRECTS ) {
- radeonEmitHwStateLocked( rmesa );
- }
-#endif
-
for ( i = 0 ; i < rmesa->numClipRects ; ) {
GLint nr = MIN2( i + RADEON_NR_SAREA_CLIPRECTS, rmesa->numClipRects );
XF86DRIClipRectPtr box = rmesa->pClipRects;
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c
index 0d61f1aa8..aa3561364 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c
@@ -362,7 +362,7 @@ radeonDDTexImage1D( GLcontext *ctx, GLenum target, GLint level,
0, texImage->Width,
format, type, packing,
pixels, data ) ) {
- fprintf( stderr, " *** convert failed!\n" );
+ /*fprintf( stderr, " *** convert failed!\n" );*/
FREE( data );
return GL_FALSE;
}
@@ -442,7 +442,11 @@ radeonDDTexImage2D( GLcontext *ctx, GLenum target, GLint level,
0, 0, texImage->Width, texImage->Height,
texImage->Width, format, type, packing,
pixels, data ) ) {
- fprintf( stderr, " *** convert failed!\n" );
+ if ( 0 )
+ fprintf( stderr, " *** convert failed! %s/%s-> %s\n",
+ gl_lookup_enum_by_nr( format ),
+ gl_lookup_enum_by_nr( type ),
+ gl_lookup_enum_by_nr( texImage->IntFormat ) );
FREE( data );
return GL_FALSE;
}
@@ -560,15 +564,17 @@ radeonDDTexSubImage1D( GLcontext *ctx, GLenum target, GLint level,
*/
ASSERT( t );
- if ( t->bound )
+ if ( t->bound ) {
+ FLUSH_VB( ctx, "radeonDDTexSubImage2D" );
FLUSH_BATCH( rmesa );
+ }
texFormat = texImage->TexFormat;
if ( !_mesa_convert_texsubimage1d( texFormat->IntFormat,
xoffset, width, format, type, packing,
pixels, t->image[level].data ) ) {
- fprintf( stderr, " *** convert failed!\n" );
+ /*fprintf( stderr, " *** convert failed!\n" );*/
return GL_FALSE;
}
@@ -599,8 +605,10 @@ radeonDDTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
*/
ASSERT( t );
- if ( t->bound )
+ if ( t->bound ) {
+ FLUSH_VB( ctx, "radeonDDTexSubImage2D" );
FLUSH_BATCH( rmesa );
+ }
texFormat = texImage->TexFormat;
@@ -608,7 +616,7 @@ radeonDDTexSubImage2D( GLcontext *ctx, GLenum target, GLint level,
xoffset, yoffset, width, height,
texImage->Width, format, type, packing,
pixels, t->image[level].data ) ) {
- fprintf( stderr, " *** convert failed!\n" );
+ /*fprintf( stderr, " *** convert failed!\n" );*/
return GL_FALSE;
}
@@ -652,7 +660,7 @@ radeonDDTexSubImage3D( GLcontext *ctx, GLenum target, GLint level,
texImage->Width, texImage->Height,
format, type, packing,
pixels, t->image[level].data ) ) {
- fprintf( stderr, " *** convert failed!\n" );
+ /*fprintf( stderr, " *** convert failed!\n" );*/
return GL_FALSE;
}
@@ -684,8 +692,10 @@ static GLvoid *radeonDDGetTexImage( GLcontext *ctx, GLenum target, GLint level,
if ( !data )
return NULL;
- fprintf( stderr, " in=%d out=%s\n",
- texFormat->IntFormat, gl_lookup_enum_by_nr( texImage->Format ) );
+ if ( 0 )
+ fprintf( stderr, " in=%d out=%s\n",
+ texFormat->IntFormat,
+ gl_lookup_enum_by_nr( texImage->Format ) );
switch ( target ) {
case GL_TEXTURE_1D:
@@ -833,10 +843,11 @@ static void radeonDDBindTexture( GLcontext *ctx, GLenum target,
{
radeonContextPtr rmesa = RADEON_CONTEXT(ctx);
radeonTexObjPtr t = (radeonTexObjPtr) tObj->DriverData;
+ GLuint unit = ctx->Texture.CurrentUnit;
if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) {
fprintf( stderr, "%s( %p ) unit=%d\n",
- __FUNCTION__, tObj, ctx->Texture.CurrentUnit );
+ __FUNCTION__, tObj, unit );
}
FLUSH_BATCH( rmesa );
@@ -846,6 +857,18 @@ static void radeonDDBindTexture( GLcontext *ctx, GLenum target,
tObj->DriverData = t;
}
+ /* Unbind a currently bound texture.
+ */
+ if ( rmesa->CurrentTexObj[unit] ) {
+ rmesa->CurrentTexObj[unit]->bound &= ~(unit + 1);
+ rmesa->CurrentTexObj[unit] = NULL;
+ }
+
+ /* Bind to the given texture unit.
+ */
+ rmesa->CurrentTexObj[unit] = t;
+ t->bound |= unit + 1;
+
rmesa->new_state |= RADEON_NEW_TEXTURE;
}
@@ -858,8 +881,8 @@ static void radeonDDDeleteTexture( GLcontext *ctx,
if ( t ) {
if ( t->bound ) {
FLUSH_BATCH( rmesa );
-
- rmesa->CurrentTexObj[t->bound-1] = 0;
+ if ( t->bound & TEX_0 ) rmesa->CurrentTexObj[0] = NULL;
+ if ( t->bound & TEX_1 ) rmesa->CurrentTexObj[1] = NULL;
rmesa->new_state |= RADEON_NEW_TEXTURE;
}
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c
index 782cc99e5..52c202bee 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texmem.c
@@ -63,8 +63,9 @@ void radeonDestroyTexObj( radeonContextPtr rmesa, radeonTexObjPtr t )
if ( t->tObj )
t->tObj->DriverData = NULL;
- if ( t->bound )
- rmesa->CurrentTexObj[t->bound-1] = NULL;
+
+ if ( t->bound & TEX_0 ) rmesa->CurrentTexObj[0] = NULL;
+ if ( t->bound & TEX_1 ) rmesa->CurrentTexObj[1] = NULL;
remove_from_list( t );
FREE( t );
@@ -392,7 +393,7 @@ int radeonUploadTexImages( radeonContextPtr rmesa, radeonTexObjPtr t )
if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) {
fprintf( stderr, "%s( %p, %p )\n",
- __FUNCTION__, rmesa->glCtx, t );
+ __FUNCTION__, rmesa->glCtx, t->tObj );
}
if ( !t )
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h b/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h
index bd2bf8948..7cec84e9a 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texobj.h
@@ -40,6 +40,9 @@ USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "radeon_sarea.h"
#include "mm.h"
+#define TEX_0 1
+#define TEX_1 2
+
typedef struct radeon_tex_obj radeonTexObj, *radeonTexObjPtr;
/* Texture object in locally shared texture space.
diff --git a/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c b/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c
index 310f46070..2a076717e 100644
--- a/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c
+++ b/xc/lib/GL/mesa/src/drv/radeon/radeon_texstate.c
@@ -673,7 +673,7 @@ static void radeonUpdateTextureEnv( GLcontext *ctx, int unit )
GLuint i, numColorArgs = 0, numAlphaArgs = 0;
GLuint op;
- if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) {
+ if ( RADEON_DEBUG & DEBUG_VERBOSE_MSG ) {
fprintf( stderr, "%s( %p, %d )\n",
__FUNCTION__, ctx, unit );
}
@@ -1022,7 +1022,7 @@ static void radeonUpdateTextureObject( GLcontext *ctx, int unit )
radeonTexObjPtr t;
GLuint enabled;
- if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) {
+ if ( RADEON_DEBUG & DEBUG_VERBOSE_MSG ) {
fprintf( stderr, "%s( %p, %d )\n",
__FUNCTION__, ctx, unit );
}
@@ -1053,14 +1053,13 @@ static void radeonUpdateTextureObject( GLcontext *ctx, int unit )
/* Force any texture images to be loaded into the hardware */
if ( t->dirty_images ) {
+ if ( RADEON_DEBUG & DEBUG_VERBOSE_API ) {
+ fprintf( stderr, " t->dirty_images = 0x%x\n", t->dirty_images );
+ }
radeonSetTexImages( rmesa, tObj );
rmesa->dirty |= (RADEON_UPLOAD_TEX0IMAGES << unit);
}
- /* Bind to the given texture unit */
- rmesa->CurrentTexObj[unit] = t;
- t->bound = unit + 1;
-
if ( t->memBlock )
radeonUpdateTexLRU( rmesa, t );
@@ -1088,12 +1087,6 @@ void radeonUpdateTextureState( GLcontext *ctx )
/* Clear any texturing fallbacks */
rmesa->Fallback &= ~RADEON_FALLBACK_TEXTURE;
- /* Unbind any currently bound textures */
- if ( rmesa->CurrentTexObj[0] ) rmesa->CurrentTexObj[0]->bound = 0;
- if ( rmesa->CurrentTexObj[1] ) rmesa->CurrentTexObj[1]->bound = 0;
- rmesa->CurrentTexObj[0] = NULL;
- rmesa->CurrentTexObj[1] = NULL;
-
/* Disable all texturing until it is known to be good */
rmesa->setup.pp_cntl &= ~(RADEON_TEX_ENABLE_MASK |
RADEON_TEX_BLEND_ENABLE_MASK);
diff --git a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
index 0fb7519ee..8ca93f91a 100644
--- a/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
+++ b/xc/lib/GL/mesa/src/drv/tdfx/tdfx_texman.c
@@ -155,7 +155,7 @@ static void tdfxTMDumpTexMem( tdfxContextPtr fxMesa )
#ifdef TEXSANITY
static void fubar( void )
{
- /* What am I meant to do??? */
+ /* GH: What am I meant to do??? */
}
/* Sanity Check