amd/addrlib: Not all ETC2 formats are 128bpp... add new ETC2 formats to differentiate between 64 and 128bpp formats.

This commit is contained in:
Kevin Furrow
2016-10-05 09:07:01 -04:00
committed by Marek Olšák
parent 1360018c1c
commit 047d6daf10
3 changed files with 45 additions and 19 deletions

View File

@@ -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;
/**

View File

@@ -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)));
}

View File

@@ -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