X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fdrivers%2Fdri%2Fr128%2Fr128_tex.c;h=3b2d017c1f21d98506e69a5b0c0c3e9056da54f1;hb=29c471aafc6a3fef23d553e31a555d1782854a77;hp=373ff5c76bf80dd460ab99f75e924275a5db44dc;hpb=4e713913fb88bc221eea1a18822cc782ca39af4d;p=mesa.git diff --git a/src/mesa/drivers/dri/r128/r128_tex.c b/src/mesa/drivers/dri/r128/r128_tex.c index 373ff5c76bf..3b2d017c1f2 100644 --- a/src/mesa/drivers/dri/r128/r128_tex.c +++ b/src/mesa/drivers/dri/r128/r128_tex.c @@ -36,7 +36,6 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "r128_context.h" #include "r128_state.h" #include "r128_ioctl.h" -#include "r128_vb.h" #include "r128_tris.h" #include "r128_tex.h" #include "r128_texobj.h" @@ -48,6 +47,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include "texstore.h" #include "texformat.h" #include "teximage.h" +#include "texobj.h" #include "imports.h" #include "colormac.h" #include "texobj.h" @@ -147,7 +147,7 @@ static r128TexObjPtr r128AllocTexObj( struct gl_texture_object *texObj ) r128TexObjPtr t; if ( R128_DEBUG & DEBUG_VERBOSE_API ) { - fprintf( stderr, "%s( %p )\n", __FUNCTION__, texObj ); + fprintf( stderr, "%s( %p )\n", __FUNCTION__, (void *) texObj ); } t = (r128TexObjPtr) CALLOC_STRUCT( r128_tex_obj ); @@ -199,9 +199,9 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGBA: case GL_COMPRESSED_RGBA: if (do32bpt) - return &_mesa_texformat_argb8888; + return _dri_texformat_argb8888; else - return &_mesa_texformat_argb4444; + return _dri_texformat_argb4444; /* 16-bit formats with alpha */ case GL_INTENSITY4: @@ -209,7 +209,7 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_LUMINANCE4_ALPHA4: case GL_RGBA2: case GL_RGBA4: - return &_mesa_texformat_argb4444; + return _dri_texformat_argb4444; /* 32-bit formats with alpha */ case GL_INTENSITY8: @@ -229,9 +229,9 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGBA12: case GL_RGBA16: if (!force16bpt) - return &_mesa_texformat_argb8888; + return _dri_texformat_argb8888; else - return &_mesa_texformat_argb4444; + return _dri_texformat_argb4444; /* non-sized formats without alpha */ case 1: @@ -241,16 +241,16 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB: case GL_COMPRESSED_RGB: if (do32bpt) - return &_mesa_texformat_argb8888; + return _dri_texformat_argb8888; else - return &_mesa_texformat_rgb565; + return _dri_texformat_rgb565; /* 16-bit formats without alpha */ case GL_LUMINANCE4: case GL_R3_G3_B2: case GL_RGB4: case GL_RGB5: - return &_mesa_texformat_rgb565; + return _dri_texformat_rgb565; /* 32-bit formats without alpha */ case GL_LUMINANCE8: @@ -261,9 +261,9 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_RGB12: case GL_RGB16: if (!force16bpt) - return &_mesa_texformat_argb8888; + return _dri_texformat_argb8888; else - return &_mesa_texformat_rgb565; + return _dri_texformat_rgb565; /* color-indexed formats */ case GL_COLOR_INDEX: @@ -273,7 +273,7 @@ r128ChooseTextureFormat( GLcontext *ctx, GLint internalFormat, case GL_COLOR_INDEX8_EXT: case GL_COLOR_INDEX12_EXT: case GL_COLOR_INDEX16_EXT: - return &_mesa_texformat_ci8; + return _dri_texformat_ci8; case GL_YCBCR_MESA: if (type == GL_UNSIGNED_SHORT_8_8_APPLE || @@ -462,9 +462,9 @@ static void r128TexEnv( GLcontext *ctx, GLenum target, case GL_TEXTURE_LOD_BIAS: { - CARD32 t = rmesa->setup.tex_cntl_c; + u_int32_t t = rmesa->setup.tex_cntl_c; GLint bias; - CARD32 b; + u_int32_t b; /* GTH: This isn't exactly correct, but gives good results up to a * certain point. It is better than completely ignoring the LOD @@ -484,7 +484,7 @@ static void r128TexEnv( GLcontext *ctx, GLenum target, bias = 127; } - b = (CARD32)bias & 0xff; + b = (u_int32_t)bias & 0xff; t &= ~R128_LOD_BIAS_MASK; t |= (b << R128_LOD_BIAS_SHIFT); @@ -557,15 +557,12 @@ static void r128BindTexture( GLcontext *ctx, GLenum target, struct gl_texture_object *tObj ) { if ( R128_DEBUG & DEBUG_VERBOSE_API ) { - fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, tObj, + fprintf( stderr, "%s( %p ) unit=%d\n", __FUNCTION__, (void *) tObj, ctx->Texture.CurrentUnit ); } - if ( target == GL_TEXTURE_2D || target == GL_TEXTURE_1D ) { - if ( tObj->DriverData == NULL ) { - r128AllocTexObj( tObj ); - } - } + assert( (target != GL_TEXTURE_2D && target != GL_TEXTURE_1D) || + (tObj->DriverData != NULL) ); } @@ -575,7 +572,6 @@ static void r128DeleteTexture( GLcontext *ctx, r128ContextPtr rmesa = R128_CONTEXT(ctx); driTextureObject * t = (driTextureObject *) tObj->DriverData; - assert(t); if ( t ) { if ( t->bound && rmesa ) { FLUSH_BATCH( rmesa ); @@ -598,6 +594,7 @@ r128NewTextureObject( GLcontext *ctx, GLuint name, GLenum target ) { struct gl_texture_object *obj; obj = _mesa_new_texture_object(ctx, name, target); + r128AllocTexObj( obj ); return obj; } @@ -614,5 +611,7 @@ void r128InitTextureFuncs( struct dd_function_table *functions ) functions->NewTextureObject = r128NewTextureObject; functions->DeleteTexture = r128DeleteTexture; functions->IsTextureResident = driIsTextureResident; + + driInitTextureFormats(); }