amd/addrlib: Add support for ETC2 and ASTC formats.
authorKevin Furrow <kevin.furrow@amd.com>
Fri, 16 Sep 2016 12:48:54 +0000 (08:48 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 30 Mar 2017 12:44:33 +0000 (14:44 +0200)
src/amd/addrlib/addrtypes.h
src/amd/addrlib/core/addrelemlib.cpp
src/amd/addrlib/core/addrelemlib.h

index 4d09c4374bdb91a4abc93f744a26f37b56fe5086..4d94a838a438535f183e715a6c294baaedcf1c9c 100644 (file)
@@ -273,6 +273,20 @@ typedef enum _AddrFormat {
     ADDR_FMT_APC7                                 = 0x0000003d,
     ADDR_FMT_CTX1                                 = 0x0000003e,
     ADDR_FMT_RESERVED_63                          = 0x0000003f,
+    ADDR_FMT_ASTC_4x4                             = 0x00000040,
+    ADDR_FMT_ASTC_5x4                             = 0x00000041,
+    ADDR_FMT_ASTC_5x5                             = 0x00000042,
+    ADDR_FMT_ASTC_6x5                             = 0x00000043,
+    ADDR_FMT_ASTC_6x6                             = 0x00000044,
+    ADDR_FMT_ASTC_8x5                             = 0x00000045,
+    ADDR_FMT_ASTC_8x6                             = 0x00000046,
+    ADDR_FMT_ASTC_8x8                             = 0x00000047,
+    ADDR_FMT_ASTC_10x5                            = 0x00000048,
+    ADDR_FMT_ASTC_10x6                            = 0x00000049,
+    ADDR_FMT_ASTC_10x8                            = 0x0000004a,
+    ADDR_FMT_ASTC_10x10                           = 0x0000004b,
+    ADDR_FMT_ASTC_12x10                           = 0x0000004c,
+    ADDR_FMT_ASTC_12x12                           = 0x0000004d,
 } AddrFormat;
 
 /**
index 770cee3f947787bbdc1773fb4be5914058e35969..477a078705ae2799f0d38aa10252ed536b2d374f 100644 (file)
@@ -1172,6 +1172,8 @@ VOID ElemLib::AdjustSurfaceInfo(
             case ADDR_PACKED_BC3: // Fall through
             case ADDR_PACKED_BC5: // Fall through
                 bBCnFormat = TRUE;
+                // fall through
+            case ADDR_PACKED_ASTC:
                 packedBits = 128;
                 break;
             case ADDR_ROUND_BY_HALF:  // Fall through
@@ -1291,7 +1293,9 @@ VOID ElemLib::RestoreSurfaceInfo(
             break;
         case ADDR_PACKED_BC2: // Fall through
         case ADDR_PACKED_BC3: // Fall through
-            case ADDR_PACKED_BC5:
+        case ADDR_PACKED_BC5:
+            // fall through
+        case ADDR_PACKED_ASTC:
             originalBits = 128;
             break;
         case ADDR_ROUND_BY_HALF:  // Fall through
@@ -1487,6 +1491,105 @@ UINT_32 ElemLib::GetBitsPerPixel(
             expandY = 4;
             bpp = 128;
             break;
+
+        case ADDR_FMT_ASTC_4x4:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 4;
+            expandY  = 4;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_5x4:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 5;
+            expandY  = 4;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_5x5:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 5;
+            expandY  = 5;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_6x5:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 6;
+            expandY  = 5;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_6x6:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 6;
+            expandY  = 6;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_8x5:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 8;
+            expandY  = 5;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_8x6:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 8;
+            expandY  = 6;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_8x8:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 8;
+            expandY  = 8;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_10x5:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 10;
+            expandY  = 5;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_10x6:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 10;
+            expandY  = 6;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_10x8:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 10;
+            expandY  = 8;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_10x10:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 10;
+            expandY  = 10;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_12x10:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 12;
+            expandY  = 10;
+            bpp      = 128;
+            break;
+
+        case ADDR_FMT_ASTC_12x12:
+            elemMode = ADDR_PACKED_ASTC;
+            expandX  = 12;
+            expandY  = 12;
+            bpp      = 128;
+            break;
+
         default:
             bpp = 0;
             ADDR_ASSERT_ALWAYS();
index c95c9d638390f0b14c85c9a6b08624011fa83ace..f8da4c24efccf03f683a53c953d69463f45ec705 100644 (file)
@@ -131,6 +131,7 @@ enum ElemMode
     ADDR_PACKED_BC3,        // Each data element is uncompressed to a 4x4 pixel/texel array
     ADDR_PACKED_BC4,        // Each data element is uncompressed to a 4x4 pixel/texel array
     ADDR_PACKED_BC5,        // Each data element is uncompressed to a 4x4 pixel/texel array
+    ADDR_PACKED_ASTC,
 
     // These formats provide various kinds of compression
     ADDR_ZPLANE_R5XX,       // Compressed Zplane using r5xx architecture format