r300g: add support for red-alpha render targets
authorMarek Olšák <maraeo@gmail.com>
Thu, 14 Feb 2013 13:59:01 +0000 (14:59 +0100)
committerMarek Olšák <maraeo@gmail.com>
Thu, 14 Feb 2013 13:59:36 +0000 (14:59 +0100)
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state.c
src/gallium/drivers/r300/r300_texture.c

index d644ebb61539c3f0a4f847adf2f028fb6a090484..06ed1cb5b5bb151fd75860958475bda8a33f6f1e 100644 (file)
@@ -410,6 +410,7 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
                             format == PIPE_FORMAT_A16_FLOAT ||
                             format == PIPE_FORMAT_L16_FLOAT ||
                             format == PIPE_FORMAT_L16A16_FLOAT ||
+                            format == PIPE_FORMAT_R16A16_FLOAT ||
                             format == PIPE_FORMAT_I16_FLOAT;
     boolean is_half_float = format == PIPE_FORMAT_R16_FLOAT ||
                             format == PIPE_FORMAT_R16G16_FLOAT ||
index bf4163cea42b299bda741e8e15cac6c87c400c7d..ad93510ab3ff01145dbb7ad849a6ea9e18459f10 100644 (file)
@@ -604,6 +604,7 @@ static void r300_set_blend_color(struct pipe_context* pipe,
             break;
 
         case PIPE_FORMAT_L8A8_UNORM:
+        case PIPE_FORMAT_R8A8_UNORM:
             c.color[2] = c.color[3];
             break;
 
index d9657306c88c66ad52a2e35c13b680de96685e8f..13e9bc3f66a089d35ff50811e72d832d32fb265f 100644 (file)
@@ -415,6 +415,8 @@ static uint32_t r300_translate_colorformat(enum pipe_format format)
         case PIPE_FORMAT_L8A8_SNORM:
         case PIPE_FORMAT_R8G8_UNORM:
         case PIPE_FORMAT_R8G8_SNORM:
+        case PIPE_FORMAT_R8A8_UNORM:
+        case PIPE_FORMAT_R8A8_SNORM:
         /* These formats work fine with UV88 if US_OUT_FMT is set correctly. */
         case PIPE_FORMAT_A16_UNORM:
         case PIPE_FORMAT_A16_SNORM:
@@ -458,6 +460,9 @@ static uint32_t r300_translate_colorformat(enum pipe_format format)
         case PIPE_FORMAT_L16A16_UNORM:
         case PIPE_FORMAT_L16A16_SNORM:
         case PIPE_FORMAT_L16A16_FLOAT:
+        case PIPE_FORMAT_R16A16_UNORM:
+        case PIPE_FORMAT_R16A16_SNORM:
+        case PIPE_FORMAT_R16A16_FLOAT:
         case PIPE_FORMAT_A32_FLOAT:
         case PIPE_FORMAT_L32_FLOAT:
         case PIPE_FORMAT_I32_FLOAT:
@@ -481,6 +486,7 @@ static uint32_t r300_translate_colorformat(enum pipe_format format)
          * correctly. */
         case PIPE_FORMAT_R32G32_FLOAT:
         case PIPE_FORMAT_L32A32_FLOAT:
+        case PIPE_FORMAT_R32A32_FLOAT:
             return R300_COLOR_FORMAT_ARGB16161616;
 
         /* 128-bit buffers. */
@@ -630,6 +636,8 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format)
          * COLORFORMAT_UV88 stores ZX (C2 and C0). */
         case PIPE_FORMAT_L8A8_SNORM:
         case PIPE_FORMAT_L8A8_UNORM:
+        case PIPE_FORMAT_R8A8_SNORM:
+        case PIPE_FORMAT_R8A8_UNORM:
             return modifier | R300_C0_SEL_A | R300_C2_SEL_R;
         case PIPE_FORMAT_R8G8_SNORM:
         case PIPE_FORMAT_R8G8_UNORM:
@@ -705,7 +713,11 @@ static uint32_t r300_translate_out_fmt(enum pipe_format format)
         case PIPE_FORMAT_L16A16_UNORM:
         case PIPE_FORMAT_L16A16_SNORM:
         case PIPE_FORMAT_L16A16_FLOAT:
+        case PIPE_FORMAT_R16A16_UNORM:
+        case PIPE_FORMAT_R16A16_SNORM:
+        case PIPE_FORMAT_R16A16_FLOAT:
         case PIPE_FORMAT_L32A32_FLOAT:
+        case PIPE_FORMAT_R32A32_FLOAT:
             return modifier |
                 R300_C0_SEL_R | R300_C1_SEL_A;
 
@@ -738,10 +750,16 @@ static uint32_t r300_translate_colormask_swizzle(enum pipe_format format)
 
     case PIPE_FORMAT_L8A8_SNORM:
     case PIPE_FORMAT_L8A8_UNORM:
+    case PIPE_FORMAT_R8A8_UNORM:
+    case PIPE_FORMAT_R8A8_SNORM:
     case PIPE_FORMAT_L16A16_UNORM:
     case PIPE_FORMAT_L16A16_SNORM:
     case PIPE_FORMAT_L16A16_FLOAT:
+    case PIPE_FORMAT_R16A16_UNORM:
+    case PIPE_FORMAT_R16A16_SNORM:
+    case PIPE_FORMAT_R16A16_FLOAT:
     case PIPE_FORMAT_L32A32_FLOAT:
+    case PIPE_FORMAT_R32A32_FLOAT:
         return COLORMASK_ARRA;
 
     case PIPE_FORMAT_R8G8_SNORM: