You're right, mgaConvertTexture needs to handle RGB5_A1 as a special
case. But there is no need to redefined MGAPACKCOLOR1555, check
MGAPACKCOLOR555.
So this is the patch to apply over the other one.
Thanks Ralf,
Karl
ralf willenbacher wrote:
>Karl Lessard wrote:
>
>>Hi everybody,
>>
>>this patch fixes some problems in texturing in the mga driver.
>>
>>1) It fixes a texture corruption problem, as the mga driver did not use
>>the right texture format in some case
>> ( I've seen that when an application wants to store a texture in
>>RGB5_A1, but it is actually stored in ARGB8 by Mesa).
>>
>
>RGB5_A1 isnt handled in mgatexconv.c
>i made a patch.
>
>
>------------------------------------------------------------------------
>
--- xc/lib/GL/mesa/src/drv/mga/mgatex.c Thu Jun 14 12:02:30 2001
+++ dri_patches/texture_blending_0/src/mgatex.c Mon Jun 18 11:35:24 2001
@@ -178,7 +178,7 @@
} \
} while (0)
- switch ( texImage->Format ) {
+ switch ( texImage->IntFormat ) {
/* GH: Bias towards GL_RGB, GL_RGBA texture formats. This has
* got to be better than sticking them way down the end of this
* huge list.
--- xc/lib/GL/mesa/src/drv/mga/mgatexcnv.c Mon Jun 4 16:51:29 2001
+++ dri_patches/texture_blending_0/src/mgatexcnv.c Mon Jun 18 11:35:52 2001
@@ -98,14 +98,27 @@
case GL_RGBA:
src = (GLubyte *)image->Data + ( y * image->Width + x ) * 4;
stride = (image->Width - width) * 4;
- for ( i = height ; i ; i-- ) {
- for ( j = width >> 1 ; j ; j-- ) {
+ if (image->IntFormat == GL_RGB5_A1) {
+ for ( i = height ; i ; i-- ) {
+ for ( j = width >> 1 ; j ; j-- ) {
- *destPtr++ = MGAPACKCOLOR4444(src[0],src[1],src[2],src[3]) |
- ( MGAPACKCOLOR4444(src[4],src[5],src[6],src[7]) << 16 );
+ *destPtr++ = MGAPACKCOLOR555(src[0],src[1],src[2],src[3]) |
+ ( MGAPACKCOLOR555(src[4],src[5],src[6],src[7]) << 16 );
+ src += 8;
+ }
+ src += stride;
+ }
+ }
+ else {
+ for ( i = height ; i ; i-- ) {
+ for ( j = width >> 1 ; j ; j-- ) {
+
+ *destPtr++ = MGAPACKCOLOR4444(src[0],src[1],src[2],src[3]) |
+ ( MGAPACKCOLOR4444(src[4],src[5],src[6],src[7]) << 16 );
src += 8;
+ }
+ src += stride;
}
- src += stride;
}
break;
case GL_LUMINANCE: