r300g: add LATC support
authorMarek Olšák <maraeo@gmail.com>
Mon, 7 Mar 2011 01:25:22 +0000 (02:25 +0100)
committerMarek Olšák <maraeo@gmail.com>
Tue, 8 Mar 2011 22:52:37 +0000 (23:52 +0100)
src/gallium/drivers/r300/r300_screen.c
src/gallium/drivers/r300/r300_state_derived.c
src/gallium/drivers/r300/r300_texture.c

index d881a0f3c872bf730e306aedf55e913a6ef9aad6..2c7bca86277adee9f93f04e3e4d5cec7eb29abe6 100644 (file)
@@ -318,9 +318,13 @@ static boolean r300_is_format_supported(struct pipe_screen* screen,
                               format == PIPE_FORMAT_B10G10R10A2_UNORM ||
                               format == PIPE_FORMAT_R10SG10SB10SA2U_NORM;
     boolean is_ati1n = format == PIPE_FORMAT_RGTC1_UNORM ||
-                       format == PIPE_FORMAT_RGTC1_SNORM;
+                       format == PIPE_FORMAT_RGTC1_SNORM ||
+                       format == PIPE_FORMAT_LATC1_UNORM ||
+                       format == PIPE_FORMAT_LATC1_SNORM;
     boolean is_ati2n = format == PIPE_FORMAT_RGTC2_UNORM ||
-                       format == PIPE_FORMAT_RGTC2_SNORM;
+                       format == PIPE_FORMAT_RGTC2_SNORM ||
+                       format == PIPE_FORMAT_LATC2_UNORM ||
+                       format == PIPE_FORMAT_LATC2_SNORM;
     boolean is_half_float = format == PIPE_FORMAT_R16_FLOAT ||
                             format == PIPE_FORMAT_R16G16_FLOAT ||
                             format == PIPE_FORMAT_R16G16B16_FLOAT ||
index a1e116f4b61882d772272eeb43b12794c7278ba5..ec00e2552ca6a7a2cc24b780ccf5871d093fb85c 100644 (file)
@@ -644,16 +644,20 @@ static uint32_t r300_get_border_color(enum pipe_format format,
         switch (format) {
         case PIPE_FORMAT_RGTC1_SNORM:
         case PIPE_FORMAT_RGTC1_UNORM:
+        case PIPE_FORMAT_LATC1_SNORM:
+        case PIPE_FORMAT_LATC1_UNORM:
             /* Add 1/32 to round the border color instead of truncating. */
             /* The Y component is used for the border color. */
             border_swizzled[1] = border_swizzled[2] + 1.0f/32;
             util_pack_color(border_swizzled, PIPE_FORMAT_B4G4R4A4_UNORM, &uc);
             return uc.ui;
         case PIPE_FORMAT_RGTC2_SNORM:
+        case PIPE_FORMAT_LATC2_SNORM:
             border_swizzled[0] = border_swizzled[2];
             util_pack_color(border_swizzled, PIPE_FORMAT_R8G8B8A8_SNORM, &uc);
             return uc.ui;
         case PIPE_FORMAT_RGTC2_UNORM:
+        case PIPE_FORMAT_LATC2_UNORM:
             util_pack_color(border_swizzled, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
             return uc.ui;
         default:
index 86ad0b8b8e04654589e6e6b9ebec3ea59124762f..70f087a4efa34d23e03ee120f2ed1f5b8c4d241b 100644 (file)
@@ -174,9 +174,11 @@ uint32_t r300_translate_texformat(enum pipe_format format,
     if (util_format_is_compressed(format) &&
         dxtc_swizzle &&
         format != PIPE_FORMAT_RGTC2_UNORM &&
-        format != PIPE_FORMAT_RGTC2_SNORM) {
+        format != PIPE_FORMAT_RGTC2_SNORM &&
+        format != PIPE_FORMAT_LATC2_UNORM &&
+        format != PIPE_FORMAT_LATC2_SNORM) {
         result |= r300_get_swizzle_combined(desc->swizzle, swizzle_view,
-                                            dxtc_swizzle);
+                                            TRUE);
     } else {
         result |= r300_get_swizzle_combined(desc->swizzle, swizzle_view,
                                             FALSE);
@@ -209,13 +211,19 @@ uint32_t r300_translate_texformat(enum pipe_format format,
     if (desc->layout == UTIL_FORMAT_LAYOUT_RGTC) {
         switch (format) {
             case PIPE_FORMAT_RGTC1_SNORM:
+            case PIPE_FORMAT_LATC1_SNORM:
                 result |= sign_bit[1];
+            case PIPE_FORMAT_LATC1_UNORM:
             case PIPE_FORMAT_RGTC1_UNORM:
                 return R500_TX_FORMAT_ATI1N | result;
+
             case PIPE_FORMAT_RGTC2_SNORM:
+            case PIPE_FORMAT_LATC2_SNORM:
                 result |= sign_bit[2] | sign_bit[3];
             case PIPE_FORMAT_RGTC2_UNORM:
+            case PIPE_FORMAT_LATC2_UNORM:
                 return R400_TX_FORMAT_ATI2N | result;
+
             default:
                 return ~0; /* Unsupported/unknown. */
         }
@@ -363,6 +371,8 @@ uint32_t r500_tx_format_msb_bit(enum pipe_format format)
     switch (format) {
         case PIPE_FORMAT_RGTC1_UNORM:
         case PIPE_FORMAT_RGTC1_SNORM:
+        case PIPE_FORMAT_LATC1_UNORM:
+        case PIPE_FORMAT_LATC1_SNORM:
         case PIPE_FORMAT_X8Z24_UNORM:
         case PIPE_FORMAT_S8_USCALED_Z24_UNORM:
             return R500_TXFORMAT_MSB;