From 047d6daf10f9ca8fc37ad32f00b3bbf926ba9e9d Mon Sep 17 00:00:00 2001 From: Kevin Furrow Date: Wed, 5 Oct 2016 09:07:01 -0400 Subject: [PATCH] amd/addrlib: Not all ETC2 formats are 128bpp... add new ETC2 formats to differentiate between 64 and 128bpp formats. --- src/amd/addrlib/addrtypes.h | 2 ++ src/amd/addrlib/core/addrelemlib.cpp | 24 +++++++++++++++++- src/amd/addrlib/core/addrelemlib.h | 38 +++++++++++++++------------- 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/src/amd/addrlib/addrtypes.h b/src/amd/addrlib/addrtypes.h index 4d94a838a43..b90f420cba1 100644 --- a/src/amd/addrlib/addrtypes.h +++ b/src/amd/addrlib/addrtypes.h @@ -287,6 +287,8 @@ typedef enum _AddrFormat { ADDR_FMT_ASTC_10x10 = 0x0000004b, ADDR_FMT_ASTC_12x10 = 0x0000004c, ADDR_FMT_ASTC_12x12 = 0x0000004d, + ADDR_FMT_ETC2_64BPP = 0x0000004e, + ADDR_FMT_ETC2_128BPP = 0x0000004f, } AddrFormat; /** diff --git a/src/amd/addrlib/core/addrelemlib.cpp b/src/amd/addrlib/core/addrelemlib.cpp index a60a667dcb4..e61648087a7 100644 --- a/src/amd/addrlib/core/addrelemlib.cpp +++ b/src/amd/addrlib/core/addrelemlib.cpp @@ -1174,8 +1174,12 @@ VOID ElemLib::AdjustSurfaceInfo( bBCnFormat = TRUE; // fall through case ADDR_PACKED_ASTC: + case ADDR_PACKED_ETC2_128BPP: packedBits = 128; break; + case ADDR_PACKED_ETC2_64BPP: + packedBits = 64; + break; case ADDR_ROUND_BY_HALF: // Fall through case ADDR_ROUND_TRUNCATE: // Fall through case ADDR_ROUND_DITHER: // Fall through @@ -1296,8 +1300,12 @@ VOID ElemLib::RestoreSurfaceInfo( case ADDR_PACKED_BC5: // fall through case ADDR_PACKED_ASTC: + case ADDR_PACKED_ETC2_128BPP: originalBits = 128; break; + case ADDR_PACKED_ETC2_64BPP: + originalBits = 64; + break; case ADDR_ROUND_BY_HALF: // Fall through case ADDR_ROUND_TRUNCATE: // Fall through case ADDR_ROUND_DITHER: // Fall through @@ -1492,6 +1500,20 @@ UINT_32 ElemLib::GetBitsPerPixel( bpp = 128; break; + case ADDR_FMT_ETC2_64BPP: + elemMode = ADDR_PACKED_ETC2_64BPP; + expandX = 4; + expandY = 4; + bpp = 64; + break; + + case ADDR_FMT_ETC2_128BPP: + elemMode = ADDR_PACKED_ETC2_128BPP; + expandX = 4; + expandY = 4; + bpp = 128; + break; + case ADDR_FMT_ASTC_4x4: elemMode = ADDR_PACKED_ASTC; expandX = 4; @@ -1725,7 +1747,7 @@ BOOL_32 ElemLib::IsBlockCompressed( AddrFormat format) ///< [in] Format { return (((format >= ADDR_FMT_BC1) && (format <= ADDR_FMT_BC7)) || - ((format >= ADDR_FMT_ASTC_4x4) && (format <= ADDR_FMT_ASTC_12x12))); + ((format >= ADDR_FMT_ASTC_4x4) && (format <= ADDR_FMT_ETC2_128BPP))); } diff --git a/src/amd/addrlib/core/addrelemlib.h b/src/amd/addrlib/core/addrelemlib.h index f8da4c24efc..f1e323639c3 100644 --- a/src/amd/addrlib/core/addrelemlib.h +++ b/src/amd/addrlib/core/addrelemlib.h @@ -115,30 +115,32 @@ enum NumberType enum ElemMode { // These formats allow both packing an unpacking - ADDR_ROUND_BY_HALF, // add 1/2 and truncate when packing this element - ADDR_ROUND_TRUNCATE, // truncate toward 0 for sign/mag, else toward neg - ADDR_ROUND_DITHER, // Pack by dithering -- requires (x,y) position + ADDR_ROUND_BY_HALF, // add 1/2 and truncate when packing this element + ADDR_ROUND_TRUNCATE, // truncate toward 0 for sign/mag, else toward neg + ADDR_ROUND_DITHER, // Pack by dithering -- requires (x,y) position // These formats only allow unpacking, no packing - ADDR_UNCOMPRESSED, // Elements are not compressed: one data element per pixel/texel - 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, + ADDR_UNCOMPRESSED, // Elements are not compressed: one data element per pixel/texel + 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_ETC2_64BPP, // ETC2 formats that use 64bpp to represent each 4x4 block + ADDR_PACKED_ETC2_128BPP, // ETC2 formats that use 128bpp to represent each 4x4 block + ADDR_PACKED_ASTC, // Various ASTC formats, all are 128bpp with varying block sizes // 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 + 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 + ADDR_END_ELEMENT // Used for range comparisons }; enum DepthPlanarType -- 2.30.2