r300-gallium: Cleanup color formats.
authorCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 28 Feb 2009 17:55:09 +0000 (09:55 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 28 Feb 2009 17:56:35 +0000 (09:56 -0800)
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state_inlines.h

index 470e1e2acb9d4d1db4e2c987d81854febd4d2a83..2fcd50481283ac505405f225859849bc7bab808b 100644 (file)
@@ -179,8 +179,11 @@ static boolean check_tex_2d_format(enum pipe_format format, boolean is_r500)
 {
     switch (format) {
         /* Colorbuffer */
+        case PIPE_FORMAT_A4R4G4B4_UNORM:
+        case PIPE_FORMAT_R5G6B5_UNORM:
+        case PIPE_FORMAT_A1R5G5B5_UNORM:
         case PIPE_FORMAT_A8R8G8B8_UNORM:
-        /* Texture */
+        /* Colorbuffer or texture */
         case PIPE_FORMAT_I8_UNORM:
         /* Z buffer */
         case PIPE_FORMAT_Z16_UNORM:
@@ -188,29 +191,25 @@ static boolean check_tex_2d_format(enum pipe_format format, boolean is_r500)
         case PIPE_FORMAT_Z24S8_UNORM:
             return TRUE;
 
-        /* XXX Supported yet unimplemented formats: */
-        case PIPE_FORMAT_A1R5G5B5_UNORM:
-        case PIPE_FORMAT_R5G6B5_UNORM:
         /* XXX These don't even exist
         case PIPE_FORMAT_A32R32G32B32:
         case PIPE_FORMAT_A16R16G16B16: */
         /* XXX Insert YUV422 packed VYUY and YVYU here */
-        /* XXX What the deuce is UV88? (r3xx accel page 14) */
-        case PIPE_FORMAT_A4R4G4B4_UNORM:
+        /* XXX What the deuce is UV88? (r3xx accel page 14)
             debug_printf("r300: Warning: Got unimplemented format: %s in %s\n",
                 pf_name(format), __FUNCTION__);
-            return FALSE;
+            return FALSE; */
 
         /* XXX Supported yet unimplemented r5xx formats: */
         /* XXX Again, what is UV1010 this time? (r5xx accel page 148) */
         /* XXX Even more that don't exist
         case PIPE_FORMAT_A10R10G10B10_UNORM:
         case PIPE_FORMAT_A2R10G10B10_UNORM:
-        case PIPE_FORMAT_I10_UNORM: */
+        case PIPE_FORMAT_I10_UNORM:
             debug_printf(
                 "r300: Warning: Got unimplemented r500 format: %s in %s\n",
                 pf_name(format), __FUNCTION__);
-            return FALSE;
+            return FALSE; */
 
         default:
             debug_printf("r300: Warning: Got unsupported format: %s in %s\n",
index e686e1fec6e8589553778953946611ecfbbbd9e3..361443a692375abf38f4afeb435338eaa421ecb3 100644 (file)
@@ -265,21 +265,24 @@ static INLINE uint32_t r300_anisotropy(float max_aniso)
 static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
 {
     switch (format) {
-        case PIPE_FORMAT_A8R8G8B8_UNORM:
-            return R300_COLOR_FORMAT_ARGB8888;
+        /* 8-bit buffers */
         case PIPE_FORMAT_I8_UNORM:
             return R300_COLOR_FORMAT_I8;
-        case PIPE_FORMAT_A1R5G5B5_UNORM:
-            return R300_COLOR_FORMAT_ARGB1555;
+        /* 16-bit buffers */
         case PIPE_FORMAT_R5G6B5_UNORM:
             return R300_COLOR_FORMAT_RGB565;
+        case PIPE_FORMAT_A1R5G5B5_UNORM:
+            return R300_COLOR_FORMAT_ARGB1555;
+        case PIPE_FORMAT_A4R4G4B4_UNORM:
+            return R300_COLOR_FORMAT_ARGB4444;
+        /* 32-bit buffers */
+        case PIPE_FORMAT_A8R8G8B8_UNORM:
+            return R300_COLOR_FORMAT_ARGB8888;
         /* XXX Not in pipe_format
         case PIPE_FORMAT_A32R32G32B32:
             return R300_COLOR_FORMAT_ARGB32323232;
         case PIPE_FORMAT_A16R16G16B16:
             return R300_COLOR_FORMAT_ARGB16161616; */
-        case PIPE_FORMAT_A4R4G4B4_UNORM:
-            return R300_COLOR_FORMAT_ARGB4444;
         /* XXX Not in pipe_format
         case PIPE_FORMAT_A10R10G10B10_UNORM:
             return R500_COLOR_FORMAT_ARGB10101010;
@@ -299,8 +302,10 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
 static INLINE uint32_t r300_translate_zsformat(enum pipe_format format)
 {
     switch (format) {
+        /* 16-bit depth, no stencil */
         case PIPE_FORMAT_Z16_UNORM:
             return R300_DEPTHFORMAT_16BIT_INT_Z;
+        /* 24-bit depth, 8-bit stencil */
         case PIPE_FORMAT_Z24S8_UNORM:
             return R300_DEPTHFORMAT_24BIT_INT_Z_8BIT_STENCIL;
         default: