TextureCacheBase: Move custom texture loading to a helper function
This commit is contained in:
parent
b27f471488
commit
3ecc5e879c
|
@ -178,6 +178,23 @@ void TextureCache::ClearRenderTargets()
|
||||||
iter->second->type = TCET_NORMAL;
|
iter->second->type = TCET_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PC_TexFormat TextureCache::LoadCustomTexture(u64 tex_hash, int texformat, unsigned int& width, unsigned int& height, u8* dest)
|
||||||
|
{
|
||||||
|
char texPathTemp[MAX_PATH];
|
||||||
|
unsigned int newWidth = 0;
|
||||||
|
unsigned int newHeight = 0;
|
||||||
|
|
||||||
|
sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (tex_hash & 0x00000000FFFFFFFFLL), texformat);
|
||||||
|
PC_TexFormat ret = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, texformat, dest);
|
||||||
|
|
||||||
|
if (ret != PC_TEX_FMT_NONE)
|
||||||
|
{
|
||||||
|
width = newWidth;
|
||||||
|
height = newHeight;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
|
TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
|
||||||
u32 address, unsigned int width, unsigned int height, int texformat,
|
u32 address, unsigned int width, unsigned int height, int texformat,
|
||||||
unsigned int tlutaddr, int tlutfmt, bool UseNativeMips, unsigned int maxlevel, bool from_tmem)
|
unsigned int tlutaddr, int tlutfmt, bool UseNativeMips, unsigned int maxlevel, bool from_tmem)
|
||||||
|
@ -272,21 +289,14 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (g_ActiveConfig.bHiresTextures)
|
if (g_ActiveConfig.bHiresTextures)
|
||||||
{
|
{
|
||||||
// Load Custom textures
|
pcfmt = LoadCustomTexture(tex_hash, texformat, width, height, temp);
|
||||||
char texPathTemp[MAX_PATH];
|
|
||||||
|
|
||||||
unsigned int newWidth = width;
|
|
||||||
unsigned int newHeight = height;
|
|
||||||
|
|
||||||
sprintf(texPathTemp, "%s_%08x_%i", SConfig::GetInstance().m_LocalCoreStartupParameter.m_strUniqueID.c_str(), (u32) (tex_hash & 0x00000000FFFFFFFFLL), texformat);
|
|
||||||
pcfmt = HiresTextures::GetHiresTex(texPathTemp, &newWidth, &newHeight, texformat, temp);
|
|
||||||
|
|
||||||
if (pcfmt != PC_TEX_FMT_NONE)
|
if (pcfmt != PC_TEX_FMT_NONE)
|
||||||
{
|
{
|
||||||
expandedWidth = width = newWidth;
|
expandedWidth = width;
|
||||||
expandedHeight = height = newHeight;
|
expandedHeight = height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -113,6 +113,7 @@ public:
|
||||||
unsigned int expanded_width, unsigned int tex_levels, PC_TexFormat pcfmt) = 0;
|
unsigned int expanded_width, unsigned int tex_levels, PC_TexFormat pcfmt) = 0;
|
||||||
virtual TCacheEntryBase* CreateRenderTargetTexture(unsigned int scaled_tex_w, unsigned int scaled_tex_h) = 0;
|
virtual TCacheEntryBase* CreateRenderTargetTexture(unsigned int scaled_tex_w, unsigned int scaled_tex_h) = 0;
|
||||||
|
|
||||||
|
|
||||||
static TCacheEntryBase* Load(unsigned int stage, u32 address, unsigned int width, unsigned int height,
|
static TCacheEntryBase* Load(unsigned int stage, u32 address, unsigned int width, unsigned int height,
|
||||||
int format, unsigned int tlutaddr, int tlutfmt, bool UseNativeMips, unsigned int maxlevel, bool from_tmem);
|
int format, unsigned int tlutaddr, int tlutfmt, bool UseNativeMips, unsigned int maxlevel, bool from_tmem);
|
||||||
static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat,
|
static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat,
|
||||||
|
@ -126,6 +127,9 @@ protected:
|
||||||
static GC_ALIGNED16(u8 *temp);
|
static GC_ALIGNED16(u8 *temp);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
static PC_TexFormat LoadCustomTexture(u64 tex_hash, int texformat, unsigned int& width, unsigned int& height, u8* dest);
|
||||||
|
|
||||||
|
|
||||||
typedef std::map<u32, TCacheEntryBase*> TexCache;
|
typedef std::map<u32, TCacheEntryBase*> TexCache;
|
||||||
|
|
||||||
static TexCache textures;
|
static TexCache textures;
|
||||||
|
|
Loading…
Reference in New Issue