r300g: fix texture formats: A4R4G4B4_UNORM, A1R5G5B5_UNORM, R5G6B5_UNORM
authorMarek Olšák <maraeo@gmail.com>
Sun, 7 Feb 2010 10:36:00 +0000 (11:36 +0100)
committerMarek Olšák <maraeo@gmail.com>
Sun, 14 Feb 2010 16:50:29 +0000 (17:50 +0100)
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state_inlines.h
src/gallium/drivers/r300/r300_texture.h

index 1668cae2f4349ce3189e54655481736b27bc2fdd..8e9f51aba2d919061144dc689cc3b92c4e457b5c 100644 (file)
@@ -216,9 +216,6 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
     switch (format) {
         /* Supported formats. */
         /* Colorbuffer */
-        case PIPE_FORMAT_A4R4G4B4_UNORM:
-        case PIPE_FORMAT_R5G6B5_UNORM:
-        case PIPE_FORMAT_A1R5G5B5_UNORM:
         case PIPE_FORMAT_A8_UNORM:
         case PIPE_FORMAT_L8_UNORM:
             retval = usage &
@@ -242,6 +239,9 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
             break;
 
         /* Colorbuffer or texture */
+        case PIPE_FORMAT_R5G6B5_UNORM:
+        case PIPE_FORMAT_A1R5G5B5_UNORM:
+        case PIPE_FORMAT_A4R4G4B4_UNORM:
         case PIPE_FORMAT_A8R8G8B8_UNORM:
         case PIPE_FORMAT_X8R8G8B8_UNORM:
         case PIPE_FORMAT_R8G8B8A8_UNORM:
index 08d8d2e97ff614cca1fff555d35321d20b4e98a4..b7676e1715c6b554b78a230ff7393249fc8124c7 100644 (file)
@@ -403,10 +403,14 @@ static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
 static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format)
 {
     switch (format) {
+        case PIPE_FORMAT_R5G6B5_UNORM:
+            /* C_5_6_5 is missing in US_OUT_FMT, but C4_8 works just fine. */
+        case PIPE_FORMAT_A1R5G5B5_UNORM:
+            /* C_1_5_5_5 is missing in US_OUT_FMT, but C4_8 works just fine. */
+        case PIPE_FORMAT_A4R4G4B4_UNORM:
+            /* C4_4 is missing in US_OUT_FMT, but C4_8 works just fine. */
         case PIPE_FORMAT_A8R8G8B8_UNORM:
         case PIPE_FORMAT_X8R8G8B8_UNORM:
-        /* XXX */
-        case PIPE_FORMAT_Z24S8_UNORM:
             return R300_US_OUT_FMT_C4_8 |
                 R300_C0_SEL_B | R300_C1_SEL_G |
                 R300_C2_SEL_R | R300_C3_SEL_A;
index 0c5ac48a24c54a0e34ebafcd694a141dde3f476f..1d2382da06d54849129d0984aec1c30b0c2cdd96 100644 (file)
@@ -60,12 +60,20 @@ static INLINE uint32_t r300_translate_texformat(enum pipe_format format)
             return R300_EASY_TX_FORMAT(X, X, X, ONE, X8) |
                 R300_TX_FORMAT_GAMMA;
         /* X16 */
+        case PIPE_FORMAT_A4R4G4B4_UNORM:
+            return R300_EASY_TX_FORMAT(X, Y, Z, W, W4Z4Y4X4);
         case PIPE_FORMAT_R16_UNORM:
         case PIPE_FORMAT_Z16_UNORM:
             return R300_EASY_TX_FORMAT(X, X, X, X, X16);
         case PIPE_FORMAT_R16_SNORM:
             return R300_EASY_TX_FORMAT(X, X, X, X, X16) |
                 R300_TX_FORMAT_SIGNED;
+        /* Z5Y6X5 */
+        case PIPE_FORMAT_R5G6B5_UNORM:
+            return R300_EASY_TX_FORMAT(X, Y, Z, ONE, Z5Y6X5);
+        /* W1Z5Y5X5*/
+        case PIPE_FORMAT_A1R5G5B5_UNORM:
+            return R300_EASY_TX_FORMAT(X, Y, Z, W, W1Z5Y5X5);
         /* Y8X8 */
         case PIPE_FORMAT_A8L8_UNORM:
             return R300_EASY_TX_FORMAT(X, X, X, Y, Y8X8);