Skip to content

Commit da1c896

Browse files
authored
Code refactor in creating platform,texture and cachepolicy (#42)
1 parent e4234d0 commit da1c896

File tree

1 file changed

+43
-44
lines changed

1 file changed

+43
-44
lines changed

Source/GmmLib/Utility/GmmLibObject.cpp

Lines changed: 43 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -64,26 +64,26 @@ GmmLib::PlatformInfo *GmmLib::PlatformInfo::Create(PLATFORM Platform, bool Overr
6464
}
6565
#endif
6666
GMM_DPF_EXIT;
67-
if (GFX_GET_CURRENT_RENDERCORE(Platform) >= IGFX_GEN12_CORE)
68-
{
69-
return new GmmLib::PlatformInfoGen12(Platform);
70-
}
71-
else if(GFX_GET_CURRENT_RENDERCORE(Platform) >= IGFX_GEN11_CORE)
72-
{
73-
return new GmmLib::PlatformInfoGen11(Platform);
74-
}
75-
else if(GFX_GET_CURRENT_RENDERCORE(Platform) >= IGFX_GEN10_CORE)
76-
{
77-
return new GmmLib::PlatformInfoGen10(Platform);
78-
}
79-
else if(GFX_GET_CURRENT_RENDERCORE(Platform) >= IGFX_GEN9_CORE)
80-
{
81-
return new GmmLib::PlatformInfoGen9(Platform);
82-
}
83-
else
67+
switch(GFX_GET_CURRENT_RENDERCORE(Platform))
8468
{
85-
return new GmmLib::PlatformInfoGen8(Platform);
69+
case IGFX_GEN12LP_CORE:
70+
case IGFX_GEN12_CORE:
71+
return new GmmLib::PlatformInfoGen12(Platform);
72+
break;
73+
case IGFX_GEN11_CORE:
74+
return new GmmLib::PlatformInfoGen11(Platform);
75+
break;
76+
case IGFX_GEN10_CORE:
77+
return new GmmLib::PlatformInfoGen10(Platform);
78+
break;
79+
case IGFX_GEN9_CORE:
80+
return new GmmLib::PlatformInfoGen9(Platform);
81+
break;
82+
default:
83+
return new GmmLib::PlatformInfoGen8(Platform);
84+
break;
8685
}
86+
8787
}
8888

8989
/////////////////////////////////////////////////////////////////////////////////////
@@ -103,34 +103,32 @@ GmmLib::GmmCachePolicyCommon *GmmLib::GmmCachePolicyCommon::Create()
103103
return pGmmGlobalContext->GetCachePolicyObj();
104104
}
105105

106-
if (GFX_GET_CURRENT_RENDERCORE(pGmmGlobalContext->GetPlatformInfo().Platform) >= IGFX_GEN12_CORE)
107-
{
108-
if(pGmmGlobalContext->GetSkuTable().FtrLocalMemory)
106+
switch(GFX_GET_CURRENT_RENDERCORE(pGmmGlobalContext->GetPlatformInfo().Platform))
109107
{
110-
pGmmCachePolicy = new GmmLib::GmmGen12dGPUCachePolicy(CachePolicy);
108+
case IGFX_GEN12LP_CORE:
109+
case IGFX_GEN12_CORE:
110+
if(pGmmGlobalContext->GetSkuTable().FtrLocalMemory)
111+
{
112+
pGmmCachePolicy = new GmmLib::GmmGen12dGPUCachePolicy(CachePolicy);
113+
}
114+
else
115+
{
116+
pGmmCachePolicy = new GmmLib::GmmGen12CachePolicy(CachePolicy);
117+
}
118+
break;
119+
case IGFX_GEN11_CORE:
120+
pGmmCachePolicy = new GmmLib::GmmGen11CachePolicy(CachePolicy);
121+
break;
122+
case IGFX_GEN10_CORE:
123+
pGmmCachePolicy = new GmmLib::GmmGen10CachePolicy(CachePolicy);
124+
break;
125+
case IGFX_GEN9_CORE:
126+
pGmmCachePolicy = new GmmLib::GmmGen9CachePolicy(CachePolicy);
127+
break;
128+
default:
129+
pGmmCachePolicy = new GmmLib::GmmGen8CachePolicy(CachePolicy);
130+
break;
111131
}
112-
else
113-
{
114-
pGmmCachePolicy = new GmmLib::GmmGen12CachePolicy(CachePolicy);
115-
}
116-
}
117-
else if(GFX_GET_CURRENT_RENDERCORE(pGmmGlobalContext->GetPlatformInfo().Platform) >= IGFX_GEN11_CORE)
118-
{
119-
pGmmCachePolicy = new GmmLib::GmmGen11CachePolicy(CachePolicy);
120-
}
121-
else if(GFX_GET_CURRENT_RENDERCORE(pGmmGlobalContext->GetPlatformInfo().Platform) >= IGFX_GEN10_CORE)
122-
{
123-
pGmmCachePolicy = new GmmLib::GmmGen10CachePolicy(CachePolicy);
124-
}
125-
126-
else if(GFX_GET_CURRENT_RENDERCORE(pGmmGlobalContext->GetPlatformInfo().Platform) >= IGFX_GEN9_CORE)
127-
{
128-
pGmmCachePolicy = new GmmLib::GmmGen9CachePolicy(CachePolicy);
129-
}
130-
else
131-
{
132-
pGmmCachePolicy = new GmmLib::GmmGen8CachePolicy(CachePolicy);
133-
}
134132

135133
if(!pGmmCachePolicy)
136134
{
@@ -177,6 +175,7 @@ GmmLib::GmmTextureCalc *GmmLib::GmmTextureCalc::Create(PLATFORM Platform, uint8_
177175
case IGFX_GEN11_CORE:
178176
return new GmmGen11TextureCalc();
179177
break;
178+
case IGFX_GEN12LP_CORE:
180179
case IGFX_GEN12_CORE:
181180
default:
182181
return new GmmGen12TextureCalc();

0 commit comments

Comments
 (0)