Hi, the attached patch adds a texture color depth option to the r128 and mga drivers. I'm not 100% sure if these cards can handle 32bpt textures on 16bit mode. Could someone test this on the respective hardware please.
Best regards, Felix ------------ __\|/__ ___ ___ ------------------------- Felix ___\_e -_/___/ __\___/ __\_____ You can do anything, Kühling (_____\Ä/____/ /_____/ /________) just not everything [EMAIL PROTECTED] \___/ \___/ U at the same time.
Index: mga/mga_xmesa.c =================================================================== RCS file: /cvs/dri/xc/xc/lib/GL/mesa/src/drv/mga/mga_xmesa.c,v retrieving revision 1.61 diff -u -r1.61 mga_xmesa.c --- mga/mga_xmesa.c 18 Oct 2003 20:40:36 -0000 1.61 +++ mga/mga_xmesa.c 19 Oct 2003 14:38:41 -0000 @@ -67,8 +67,11 @@ DRI_CONF_SECTION_PERFORMANCE DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) DRI_CONF_SECTION_END + DRI_CONF_SECTION_QUALITY + DRI_CONF_PREFERRED_BPT(0,"0,16,32") + DRI_CONF_SECTION_END DRI_CONF_END; -const GLuint __driNConfigOptions = 1; +const GLuint __driNConfigOptions = 2; #ifndef MGA_DEBUG int MGA_DEBUG = 0; @@ -344,6 +347,7 @@ mgaScreenPrivate *mgaScreen = (mgaScreenPrivate *)sPriv->private; MGASAREAPrivPtr saPriv=(MGASAREAPrivPtr)(((char*)sPriv->pSAREA)+ mgaScreen->sarea_priv_offset); + int preferred_bpt; if (MGA_DEBUG&DEBUG_VERBOSE_DRI) fprintf(stderr, "mgaCreateContext\n"); @@ -428,7 +432,10 @@ ctx->Const.MaxLineWidthAA = 10.0; ctx->Const.LineWidthGranularity = 1.0; - mmesa->default32BitTextures = (mesaVis->rgbBits >= 24); + preferred_bpt = driQueryOptioni (&mmesa->optionCache, "preferred_bpt"); + mmesa->default32BitTextures = + ( ( preferred_bpt == 0 && mesaVis->rgbBits >= 24 ) || + preferred_bpt == 32 ); mmesa->hw_stencil = mesaVis->stencilBits && mesaVis->depthBits == 24; switch (mesaVis->depthBits) { Index: r128/r128_context.c =================================================================== RCS file: /cvs/dri/xc/xc/lib/GL/mesa/src/drv/r128/r128_context.c,v retrieving revision 1.28 diff -u -r1.28 r128_context.c --- r128/r128_context.c 18 Oct 2003 20:40:36 -0000 1.28 +++ r128/r128_context.c 19 Oct 2003 14:38:42 -0000 @@ -66,19 +66,22 @@ const char __driConfigOptions[] = DRI_CONF_BEGIN + DRI_CONF_SECTION_PERFORMANCE + DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) + DRI_CONF_SECTION_END + DRI_CONF_SECTION_QUALITY + DRI_CONF_PREFERRED_BPT(0,"0,16,32") + DRI_CONF_SECTION_END #if ENABLE_PERF_BOXES DRI_CONF_SECTION_DEBUG DRI_CONF_PERFORMANCE_BOXES(false) DRI_CONF_SECTION_END #endif - DRI_CONF_SECTION_PERFORMANCE - DRI_CONF_VBLANK_MODE(DRI_CONF_VBLANK_DEF_INTERVAL_0) - DRI_CONF_SECTION_END DRI_CONF_END; #if ENABLE_PERF_BOXES -const GLuint __driNConfigOptions = 2; +const GLuint __driNConfigOptions = 3; #else -const GLuint __driNConfigOptions = 1; +const GLuint __driNConfigOptions = 2; #endif #ifndef R128_DEBUG @@ -120,6 +123,7 @@ r128ContextPtr rmesa; r128ScreenPtr r128scrn; int i; + int preferred_bpt; /* Allocate the r128 context */ rmesa = (r128ContextPtr) CALLOC( sizeof(*rmesa) ); @@ -176,6 +180,9 @@ driSetTextureSwapCounterLocation( rmesa->texture_heaps[i], & rmesa->c_textureSwaps ); } + preferred_bpt = driQueryOptioni (&rmesa->optionCache, "preferred_bpt"); + rmesa->default32BitTextures = + ( ( preferred_bpt == 0 && r128scrn->cpp == 4 ) || preferred_bpt == 32 ); rmesa->RenderIndex = -1; /* Impossible value */ Index: r128/r128_context.h =================================================================== RCS file: /cvs/dri/xc/xc/lib/GL/mesa/src/drv/r128/r128_context.h,v retrieving revision 1.37 diff -u -r1.37 r128_context.h --- r128/r128_context.h 9 Oct 2003 09:55:58 -0000 1.37 +++ r128/r128_context.h 19 Oct 2003 14:38:42 -0000 @@ -160,6 +160,8 @@ driTextureObject swapped; r128TexObjPtr CurrentTexObj[2]; + + GLboolean default32BitTextures; /* Fallback rasterization functions */ Index: r128/r128_tex.c =================================================================== RCS file: /cvs/dri/xc/xc/lib/GL/mesa/src/drv/r128/r128_tex.c,v retrieving revision 1.32 diff -u -r1.32 r128_tex.c --- r128/r128_tex.c 26 May 2003 20:04:53 -0000 1.32 +++ r128/r128_tex.c 19 Oct 2003 14:38:44 -0000 @@ -173,6 +173,7 @@ GLenum format, GLenum type ) { r128ContextPtr rmesa = R128_CONTEXT(ctx); + const GLboolean do32bpt = rmesa->default32BitTextures; (void) format; (void) type; @@ -201,7 +202,7 @@ case GL_RGB10_A2: case GL_RGBA12: case GL_RGBA16: - if (rmesa->r128Screen->cpp == 4) + if (do32bpt) return &_mesa_texformat_argb8888; else return &_mesa_texformat_argb4444; @@ -218,7 +219,7 @@ case GL_RGB10: case GL_RGB12: case GL_RGB16: - if (rmesa->r128Screen->cpp == 4) + if (do32bpt) return &_mesa_texformat_argb8888; else return &_mesa_texformat_rgb565; @@ -230,7 +231,7 @@ case GL_LUMINANCE12: case GL_LUMINANCE16: case GL_COMPRESSED_LUMINANCE: - if (rmesa->r128Screen->cpp == 4) + if (do32bpt) return &_mesa_texformat_argb8888; /* inefficient but accurate */ else return &_mesa_texformat_rgb565; @@ -242,7 +243,7 @@ case GL_INTENSITY12: case GL_INTENSITY16: case GL_COMPRESSED_INTENSITY: - if (rmesa->r128Screen->cpp == 4) + if (do32bpt) return &_mesa_texformat_argb8888; /* inefficient but accurate */ else return &_mesa_texformat_argb4444;