r300g: Add alpha render targets.
authorMathias Fröhlich <Mathias.Froehlich@gmx.net>
Sat, 30 Jan 2010 19:38:21 +0000 (11:38 -0800)
committerCorbin Simpson <MostAwesomeDude@gmail.com>
Sat, 30 Jan 2010 19:40:41 +0000 (11:40 -0800)
Signed-off-by: Corbin Simpson <MostAwesomeDude@gmail.com>
Tested-by: Mathias Fröhlich <Mathias.Froehlich@gmx.net>
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state_inlines.h

index f311284d15df2e412d79f8b861527d53b54b1ebc..7df3ad02c8c2ff6b99c62c131b0a3d8649cb329b 100644 (file)
@@ -217,6 +217,8 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
         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 &
                 (PIPE_TEXTURE_USAGE_RENDER_TARGET |
                  PIPE_TEXTURE_USAGE_DISPLAY_TARGET |
@@ -231,8 +233,6 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
         case PIPE_FORMAT_DXT3_RGBA:
         case PIPE_FORMAT_DXT5_RGBA:
         case PIPE_FORMAT_YCBCR:
-        case PIPE_FORMAT_L8_UNORM:
-        case PIPE_FORMAT_A8_UNORM:
         case PIPE_FORMAT_A8L8_UNORM:
             retval = usage & PIPE_TEXTURE_USAGE_SAMPLER;
             break;
index e2180b33b77841655034d5bfb0734ace8c900a75..faa049492fe7bbec72268b97f13871962b27cdb7 100644 (file)
@@ -331,7 +331,10 @@ static INLINE uint32_t r300_translate_colorformat(enum pipe_format format)
 {
     switch (format) {
         /* 8-bit buffers */
+        case PIPE_FORMAT_A8_UNORM:
         case PIPE_FORMAT_I8_UNORM:
+        case PIPE_FORMAT_L8_UNORM:
+        /* case PIPE_FORMAT_S8_UNORM: ??? */
             return R300_COLOR_FORMAT_I8;
         /* 16-bit buffers */
         case PIPE_FORMAT_R5G6B5_UNORM:
@@ -408,6 +411,16 @@ static INLINE uint32_t r300_translate_out_fmt(enum pipe_format format)
             return R300_US_OUT_FMT_C4_8 |
                 R300_C0_SEL_A | R300_C1_SEL_B |
                 R300_C2_SEL_G | R300_C3_SEL_R;
+
+        /* 8-bit outputs */
+        case PIPE_FORMAT_A8_UNORM:
+            return R300_US_OUT_FMT_C4_8 |
+                R300_C0_SEL_A;
+        case PIPE_FORMAT_I8_UNORM:
+        case PIPE_FORMAT_L8_UNORM:
+            return R300_US_OUT_FMT_C4_8 |
+                R300_C0_SEL_R;
+ /* R300_OUT_SIGN(x) */
         default:
             debug_printf("r300: Implementation error: "
                 "Got unsupported output format %s in %s\n",