diff options
Diffstat (limited to 'xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c')
-rw-r--r-- | xc/lib/GL/mesa/src/drv/radeon/radeon_tex.c | 47 |
1 files changed, 35 insertions, 12 deletions
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; } |