mirror of https://github.com/intel/gmmlib.git
Generic texture calculation for HiZ
Change-Id: I94ba01620036bb6b3b34c8ce5b65d7e7572630a6
This commit is contained in:
parent
2eea1a175a
commit
932fb0addd
|
@ -507,5 +507,6 @@ GmmLib::PlatformInfoGen10::PlatformInfoGen10(PLATFORM &Platform)
|
|||
//---------------------------------------------
|
||||
Data.SurfaceMaxSize = GMM_GBYTE(256);
|
||||
Data.MaxGpuVirtualAddressBitsPerResource = 38;
|
||||
Data.HiZPixelsPerByte = 2;
|
||||
}
|
||||
#endif // #if (IGFX_GEN >= IGFX_GEN10)
|
||||
|
|
|
@ -430,4 +430,6 @@ GmmLib::PlatformInfoGen8::PlatformInfoGen8(PLATFORM &Platform)
|
|||
Data.SurfaceMaxSize = GMM_GBYTE(2);
|
||||
Data.MaxGpuVirtualAddressBitsPerResource = 31;
|
||||
Data.MaxSLMSize = GMM_KBYTE(384);
|
||||
|
||||
Data.HiZPixelsPerByte = 2;
|
||||
}
|
|
@ -489,4 +489,6 @@ GmmLib::PlatformInfoGen9::PlatformInfoGen9(PLATFORM &Platform)
|
|||
{
|
||||
Data.MaxSLMSize = GMM_KBYTE(576);
|
||||
}
|
||||
|
||||
Data.HiZPixelsPerByte = 2;
|
||||
}
|
||||
|
|
|
@ -134,6 +134,8 @@ GMM_STATUS GMM_STDCALL GmmLib::GmmResourceInfoCommon::Create(Context &GmmLibCont
|
|||
pGmmLibContext = reinterpret_cast<uint64_t>(&GmmLibContext);
|
||||
|
||||
#if(!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
|
||||
// Client ULT does new on ResInfo without calling GmmInitGlobalContext. If they call create later, on the previously created
|
||||
// ResInfo object set the clientContext for them, since clientContext wouldnt have been set
|
||||
if(!pClientContext)
|
||||
{
|
||||
pClientContext = pGmmGlobalContext->pGmmGlobalClientContext;
|
||||
|
@ -763,7 +765,7 @@ uint32_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::GetQPitch()
|
|||
// 2D/CUBE ==> distance in rows between array slices
|
||||
// 3D ==> distance in rows between R-slices
|
||||
// Compressed ==> one row contains a complete compression block vertically
|
||||
// HiZ ==> 2 * HZ_QPitch
|
||||
// HiZ ==> HZ_PxPerByte * HZ_QPitch
|
||||
// Stencil ==> logical, i.e. not halved
|
||||
|
||||
if((GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN9_CORE) &&
|
||||
|
@ -780,7 +782,7 @@ uint32_t GMM_STDCALL GmmLib::GmmResourceInfoCommon::GetQPitch()
|
|||
}
|
||||
else if(Surf.Flags.Gpu.HiZ)
|
||||
{
|
||||
QPitch = Surf.Alignment.QPitch * 2;
|
||||
QPitch = Surf.Alignment.QPitch * pPlatform->HiZPixelsPerByte;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -94,6 +94,7 @@ GMM_STATUS GmmLib::GmmTextureCalc::PreProcessTexSpecialCases(GMM_TEXTURE_INFO *p
|
|||
{
|
||||
uint32_t h0, h1, hL, i, NumSamples, QPitch, Z_HeightL;
|
||||
uint32_t HZ_HAlign = 16, HZ_VAlign = 8;
|
||||
uint8_t HZ_DepthRows = pPlatform->HiZPixelsPerByte;
|
||||
|
||||
// HZ operates in pixel space starting from SKL. So, it does not care
|
||||
// whether the depth buffer is in MSAA mode or not.
|
||||
|
@ -135,13 +136,13 @@ GMM_STATUS GmmLib::GmmTextureCalc::PreProcessTexSpecialCases(GMM_TEXTURE_INFO *p
|
|||
(pTexInfo->MaxLod > 0) ?
|
||||
(h0 + GFX_MAX(h1, Z_HeightL)) :
|
||||
h0;
|
||||
QPitch /= 2;
|
||||
QPitch /= HZ_DepthRows;
|
||||
pTexInfo->ArraySize = Z_Depth;
|
||||
pTexInfo->BaseHeight = QPitch;
|
||||
}
|
||||
|
||||
pTexInfo->Alignment.HAlign = HZ_HAlign;
|
||||
pTexInfo->Alignment.VAlign = HZ_VAlign / 2;
|
||||
pTexInfo->Alignment.VAlign = HZ_VAlign / HZ_DepthRows;
|
||||
}
|
||||
else //if (GFX_GET_CURRENT_RENDERCORE(pPlatform->Platform) >= IGFX_GEN7_CORE)
|
||||
{
|
||||
|
|
|
@ -263,6 +263,8 @@ typedef struct __GMM_PLATFORM_RESOURCE_REC
|
|||
int64_t SurfaceMaxSize; // int64_t - Surface size is 64 bit for all configurations
|
||||
uint32_t MaxGpuVirtualAddressBitsPerResource;
|
||||
uint32_t MaxSLMSize;
|
||||
|
||||
uint8_t HiZPixelsPerByte; //HiZ-Bpp is < 1, keep inverse
|
||||
}__GMM_PLATFORM_RESOURCE, GMM_PLATFORM_INFO;
|
||||
|
||||
//***************************************************************************
|
||||
|
|
|
@ -137,7 +137,8 @@ namespace GmmLib
|
|||
pClientContext()
|
||||
{
|
||||
#if (!defined(__GMM_KMD__) && !defined(GMM_UNIFIED_LIB))
|
||||
if (pGmmGlobalContext)
|
||||
// For clients, who derive classes from GMM class and call their derived class constructors
|
||||
if (pGmmGlobalContext) // Client ULT does new on ResInfo without calling GmmInitGlobalContext.
|
||||
{
|
||||
pClientContext = pGmmGlobalContext->pGmmGlobalClientContext;
|
||||
GET_GMM_CLIENT_TYPE(pClientContext, ClientType);
|
||||
|
@ -383,6 +384,10 @@ namespace GmmLib
|
|||
/////////////////////////////////////////////////////////////////////////////////////
|
||||
GMM_INLINE_VIRTUAL GMM_INLINE uint32_t GMM_STDCALL GetAuxQPitch()
|
||||
{
|
||||
const GMM_PLATFORM_INFO *pPlatform;
|
||||
|
||||
pPlatform = GMM_OVERRIDE_PLATFORM_INFO(&Surf);
|
||||
|
||||
if (Surf.Flags.Gpu.UnifiedAuxSurface)
|
||||
{
|
||||
if (GmmIsPlanar(Surf.Format))
|
||||
|
@ -391,8 +396,8 @@ namespace GmmLib
|
|||
}
|
||||
else if (AuxSurf.Flags.Gpu.HiZ)
|
||||
{
|
||||
// HiZ ==> 2 * HZ_QPitch
|
||||
return AuxSurf.Alignment.QPitch * 2;
|
||||
// HiZ ==> HZ_PxPerByte * HZ_QPitch
|
||||
return AuxSurf.Alignment.QPitch * pPlatform->HiZPixelsPerByte;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue