translate_generic: fix broken A8R8G8B8_UNORM output
authorLuca Barbieri <luca@luca-barbieri.com>
Wed, 11 Aug 2010 14:00:32 +0000 (16:00 +0200)
committerLuca Barbieri <luca@luca-barbieri.com>
Wed, 11 Aug 2010 14:27:58 +0000 (16:27 +0200)
translate was attempting to output A8R8G8B8_UNORM as if it were
R8G8B8A8_UNORM.

Now the tests just added pass.

src/gallium/auxiliary/translate/translate_generic.c

index 809a4e47f4da58984fb4fbac73bba1fcf5a13243..021099ae980286a80851667a032686af5a7fb9fa 100644 (file)
@@ -187,9 +187,15 @@ ATTRIB( R8G8B8_SNORM,    3, char, TO_8_SNORM )
 ATTRIB( R8G8_SNORM,      2, char, TO_8_SNORM )
 ATTRIB( R8_SNORM,        1, char, TO_8_SNORM )
 
-ATTRIB( A8R8G8B8_UNORM,       4, ubyte, TO_8_UNORM )
-/*ATTRIB( R8G8B8A8_UNORM,       4, ubyte, TO_8_UNORM )*/
-
+static void
+emit_A8R8G8B8_UNORM( const float *attrib, void *ptr)
+{
+   ubyte *out = (ubyte *)ptr;
+   out[0] = TO_8_UNORM(attrib[3]);
+   out[1] = TO_8_UNORM(attrib[0]);
+   out[2] = TO_8_UNORM(attrib[1]);
+   out[3] = TO_8_UNORM(attrib[2]);
+}
 
 static void
 emit_B8G8R8A8_UNORM( const float *attrib, void *ptr)