*/
/**
-***************************************************************************************************
+****************************************************************************************************
* @file addrelemlib.h
-* @brief Contains the class for element/pixel related functions
-***************************************************************************************************
+* @brief Contains the class for element/pixel related functions.
+****************************************************************************************************
*/
#ifndef __ELEM_LIB_H__
#include "addrobject.h"
#include "addrcommon.h"
-class AddrLib;
+namespace Addr
+{
+
+class Lib;
// The masks for property bits within the Properties INT_32
-union ADDR_COMPONENT_FLAGS
+union ComponentFlags
{
struct
{
UINT_32 value;
};
-// Copy from legacy lib's AddrNumberType
-enum AddrNumberType
+// Copy from legacy lib's NumberType
+enum NumberType
{
// The following number types have the range [-1..1]
ADDR_NO_NUMBER, // This component doesn't exist and has no default value
};
// Copy from legacy lib's AddrElement
-enum AddrElemMode
+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_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 AddrDepthPlanarType
+enum DepthPlanarType
{
ADDR_DEPTH_PLANAR_NONE = 0, // No plane z/stencl
ADDR_DEPTH_PLANAR_R600 = 1, // R600 z and stencil planes are store within a tile
};
/**
-***************************************************************************************************
-* ADDR_PIXEL_FORMATINFO
+****************************************************************************************************
+* PixelFormatInfo
*
* @brief
* Per component info
*
-***************************************************************************************************
+****************************************************************************************************
*/
-struct ADDR_PIXEL_FORMATINFO
+struct PixelFormatInfo
{
UINT_32 compBit[4];
- AddrNumberType numType[4];
+ NumberType numType[4];
UINT_32 compStart[4];
- AddrElemMode elemMode;
+ ElemMode elemMode;
UINT_32 comps; ///< Number of components
};
/**
-***************************************************************************************************
+****************************************************************************************************
* @brief This class contains asic indepentent element related attributes and operations
-***************************************************************************************************
+****************************************************************************************************
*/
-class AddrElemLib : public AddrObject
+class ElemLib : public Object
{
protected:
- AddrElemLib(AddrLib* const pAddrLib);
+ ElemLib(Lib* pAddrLib);
public:
/// Makes this class virtual
- virtual ~AddrElemLib();
+ virtual ~ElemLib();
- static AddrElemLib *Create(
- const AddrLib* const pAddrLib);
+ static ElemLib* Create(
+ const Lib* pAddrLib);
/// The implementation is only for R6xx/R7xx, so make it virtual in case we need for R8xx
BOOL_32 PixGetExportNorm(
const ADDR_FLT_32 comps[4], UINT_8 *pPixel) const;
static VOID Flt32sToInt32s(
- ADDR_FLT_32 value, UINT_32 bits, AddrNumberType numberType, UINT_32* pResult);
+ ADDR_FLT_32 value, UINT_32 bits, NumberType numberType, UINT_32* pResult);
static VOID Int32sToPixel(
UINT_32 numComps, UINT_32* pComps, UINT_32* pCompBits, UINT_32* pCompStart,
- ADDR_COMPONENT_FLAGS properties, UINT_32 resultBits, UINT_8* pPixel);
+ ComponentFlags properties, UINT_32 resultBits, UINT_8* pPixel);
VOID PixGetColorCompInfo(
AddrColorFormat format, AddrSurfaceNumber number, AddrSurfaceSwap swap,
- ADDR_PIXEL_FORMATINFO* pInfo) const;
+ PixelFormatInfo* pInfo) const;
VOID PixGetDepthCompInfo(
- AddrDepthFormat format, ADDR_PIXEL_FORMATINFO* pInfo) const;
+ AddrDepthFormat format, PixelFormatInfo* pInfo) const;
UINT_32 GetBitsPerPixel(
- AddrFormat format, AddrElemMode* pElemMode,
+ AddrFormat format, ElemMode* pElemMode = NULL,
UINT_32* pExpandX = NULL, UINT_32* pExpandY = NULL, UINT_32* pBitsUnused = NULL);
static VOID SetClearComps(
ADDR_FLT_32 comps[4], BOOL_32 clearColor, BOOL_32 float32);
VOID AdjustSurfaceInfo(
- AddrElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
+ ElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
UINT_32* pBpp, UINT_32* pBasePitch, UINT_32* pWidth, UINT_32* pHeight);
VOID RestoreSurfaceInfo(
- AddrElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
+ ElemMode elemMode, UINT_32 expandX, UINT_32 expandY,
UINT_32* pBpp, UINT_32* pWidth, UINT_32* pHeight);
/// Checks if depth and stencil are planar inside a tile
}
/// Sets m_configFlags, copied from AddrLib
- VOID SetConfigFlags(AddrConfigFlags flags)
+ VOID SetConfigFlags(ConfigFlags flags)
{
m_configFlags = flags;
}
static BOOL_32 IsCompressed(AddrFormat format);
static BOOL_32 IsBlockCompressed(AddrFormat format);
static BOOL_32 IsExpand3x(AddrFormat format);
+ static BOOL_32 IsMacroPixelPacked(AddrFormat format);
protected:
static VOID GetCompBits(
UINT_32 c0, UINT_32 c1, UINT_32 c2, UINT_32 c3,
- ADDR_PIXEL_FORMATINFO* pInfo,
- AddrElemMode elemMode = ADDR_ROUND_BY_HALF);
+ PixelFormatInfo* pInfo,
+ ElemMode elemMode = ADDR_ROUND_BY_HALF);
static VOID GetCompType(
AddrColorFormat format, AddrSurfaceNumber numType,
- ADDR_PIXEL_FORMATINFO* pInfo);
+ PixelFormatInfo* pInfo);
static VOID GetCompSwap(
- AddrSurfaceSwap swap, ADDR_PIXEL_FORMATINFO* pInfo);
+ AddrSurfaceSwap swap, PixelFormatInfo* pInfo);
static VOID SwapComps(
- UINT_32 c0, UINT_32 c1, ADDR_PIXEL_FORMATINFO* pInfo);
+ UINT_32 c0, UINT_32 c1, PixelFormatInfo* pInfo);
private:
UINT_32 m_fp16ExportNorm; ///< If allow FP16 to be reported as EXPORT_NORM
- AddrDepthPlanarType m_depthPlanarType;
+ DepthPlanarType m_depthPlanarType;
- AddrConfigFlags m_configFlags; ///< Copy of AddrLib's configFlags
- AddrLib* const m_pAddrLib; ///< Pointer to parent addrlib instance
+ ConfigFlags m_configFlags; ///< Copy of AddrLib's configFlags
+ Addr::Lib* const m_pAddrLib; ///< Pointer to parent addrlib instance
};
+} //Addr
+
#endif