[Mesa-dev] [PATCH 055/140] amd/addrlib: Add support for ETC2 and ASTC formats.
Marek Olšák
maraeo at gmail.com
Mon Mar 20 22:43:05 UTC 2017
From: Kevin Furrow <kevin.furrow at amd.com>
---
src/amd/addrlib/addrtypes.h | 14 +++++
src/amd/addrlib/core/addrelemlib.cpp | 105 ++++++++++++++++++++++++++++++++++-
src/amd/addrlib/core/addrelemlib.h | 1 +
3 files changed, 119 insertions(+), 1 deletion(-)
diff --git a/src/amd/addrlib/addrtypes.h b/src/amd/addrlib/addrtypes.h
index 4d09c43..4d94a83 100644
--- a/src/amd/addrlib/addrtypes.h
+++ b/src/amd/addrlib/addrtypes.h
@@ -266,20 +266,34 @@ typedef enum _AddrFormat {
ADDR_FMT_BC6 = 0x00000036,
ADDR_FMT_BC7 = 0x00000037,
ADDR_FMT_32_AS_32_32_32_32 = 0x00000038,
ADDR_FMT_APC3 = 0x00000039,
ADDR_FMT_APC4 = 0x0000003a,
ADDR_FMT_APC5 = 0x0000003b,
ADDR_FMT_APC6 = 0x0000003c,
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;
/**
****************************************************************************************************
* AddrDepthFormat
*
* @brief
* Neutral enum for addrFlt32ToDepthPixel
*
****************************************************************************************************
diff --git a/src/amd/addrlib/core/addrelemlib.cpp b/src/amd/addrlib/core/addrelemlib.cpp
index 770cee3..477a078 100644
--- a/src/amd/addrlib/core/addrelemlib.cpp
+++ b/src/amd/addrlib/core/addrelemlib.cpp
@@ -1165,20 +1165,22 @@ VOID ElemLib::AdjustSurfaceInfo(
break;
case ADDR_PACKED_BC1: // Fall through
case ADDR_PACKED_BC4:
packedBits = 64;
bBCnFormat = TRUE;
break;
case ADDR_PACKED_BC2: // Fall through
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
case ADDR_ROUND_TRUNCATE: // Fall through
case ADDR_ROUND_DITHER: // Fall through
case ADDR_UNCOMPRESSED:
packedBits = bpp;
break;
default:
packedBits = bpp;
@@ -1284,21 +1286,23 @@ VOID ElemLib::RestoreSurfaceInfo(
case ADDR_PACKED_GBGR:
case ADDR_PACKED_BGRG:
originalBits = bpp; // 32-bit packed ==> 2 32-bit result
break;
case ADDR_PACKED_BC1: // Fall through
case ADDR_PACKED_BC4:
originalBits = 64;
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
case ADDR_ROUND_TRUNCATE: // Fall through
case ADDR_ROUND_DITHER: // Fall through
case ADDR_UNCOMPRESSED:
originalBits = bpp;
break;
default:
originalBits = bpp;
@@ -1480,20 +1484,119 @@ UINT_32 ElemLib::GetBitsPerPixel(
bpp = 128;
break;
case ADDR_FMT_BC5:
case ADDR_FMT_BC6: // reuse ADDR_PACKED_BC5
case ADDR_FMT_BC7: // reuse ADDR_PACKED_BC5
elemMode = ADDR_PACKED_BC5;
expandX = 4;
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();
break;
// @@ or should this be an error?
}
SafeAssign(pExpandX, expandX);
SafeAssign(pExpandY, expandY);
SafeAssign(pUnusedBits, bitUnused);
diff --git a/src/amd/addrlib/core/addrelemlib.h b/src/amd/addrlib/core/addrelemlib.h
index c95c9d6..f8da4c2 100644
--- a/src/amd/addrlib/core/addrelemlib.h
+++ b/src/amd/addrlib/core/addrelemlib.h
@@ -124,20 +124,21 @@ enum ElemMode
ADDR_EXPANDED, // Elements are split up and stored in multiple data elements
ADDR_PACKED_STD, // Elements are compressed into ExpandX by ExpandY data elements
ADDR_PACKED_REV, // Like ADDR_PACKED, but X order of pixels is reverved
ADDR_PACKED_GBGR, // Elements are compressed 4:2:2 in G1B_G0R order (high to low)
ADDR_PACKED_BGRG, // Elements are compressed 4:2:2 in BG1_RG0 order (high to low)
ADDR_PACKED_BC1, // Each data element is uncompressed to a 4x4 pixel/texel array
ADDR_PACKED_BC2, // Each data element is uncompressed to a 4x4 pixel/texel array
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
ADDR_ZPLANE_R6XX, // Compressed Zplane using r6xx architecture format
//@@ Fill in the compression modes
ADDR_END_ELEMENT // Used for range comparisons
};
enum DepthPlanarType
--
2.7.4
More information about the mesa-dev
mailing list