TextureCache: inline arguments into texture cache

This commit is contained in:
degasus 2015-01-11 12:48:04 +01:00
parent 2b47df07b6
commit 1261f5f7f4
3 changed files with 15 additions and 14 deletions

View File

@ -290,10 +290,20 @@ static TextureCache::TCacheEntryBase* ReturnEntry(unsigned int stage, TextureCac
return entry; return entry;
} }
TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage, TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage)
u32 const address, unsigned int width, unsigned int height, int const texformat,
unsigned int const tlutaddr, int const tlutfmt, bool const use_mipmaps, unsigned int maxlevel, bool const from_tmem)
{ {
const FourTexUnits &tex = bpmem.tex[stage >> 2];
const u32 id = stage & 3;
const u32 address = (tex.texImage3[id].image_base/* & 0x1FFFFF*/) << 5;
u32 width = tex.texImage0[id].width + 1;
u32 height = tex.texImage0[id].height + 1;
const int texformat = tex.texImage0[id].format;
const u32 tlutaddr = tex.texTlut[id].tmem_offset << 9;
const u32 tlutfmt = tex.texTlut[id].tlut_format;
const bool use_mipmaps = (tex.texMode0[id].min_filter & 3) != 0;
u32 maxlevel = (tex.texMode1[id].max_lod + 0xf) / 0x10;
const bool from_tmem = tex.texImage1[id].image_type != 0;
if (0 == address) if (0 == address)
return nullptr; return nullptr;

View File

@ -105,8 +105,7 @@ public:
virtual void CompileShaders() = 0; // currently only implemented by OGL virtual void CompileShaders() = 0; // currently only implemented by OGL
virtual void DeleteShaders() = 0; // currently only implemented by OGL virtual void DeleteShaders() = 0; // currently only implemented by OGL
static TCacheEntryBase* Load(unsigned int stage, u32 address, unsigned int width, unsigned int height, static TCacheEntryBase* Load(const u32 stage);
int format, unsigned int tlutaddr, int tlutfmt, bool use_mipmaps, unsigned int maxlevel, bool from_tmem);
static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat, static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat,
const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf);

View File

@ -202,15 +202,7 @@ void VertexManager::Flush()
for (unsigned int i : usedtextures) for (unsigned int i : usedtextures)
{ {
g_renderer->SetSamplerState(i & 3, i >> 2); g_renderer->SetSamplerState(i & 3, i >> 2);
const FourTexUnits &tex = bpmem.tex[i >> 2]; const TextureCache::TCacheEntryBase* tentry = TextureCache::Load(i);
const TextureCache::TCacheEntryBase* tentry = TextureCache::Load(i,
(tex.texImage3[i&3].image_base/* & 0x1FFFFF*/) << 5,
tex.texImage0[i&3].width + 1, tex.texImage0[i&3].height + 1,
tex.texImage0[i&3].format, tex.texTlut[i&3].tmem_offset<<9,
tex.texTlut[i&3].tlut_format,
((tex.texMode0[i&3].min_filter & 3) != 0),
(tex.texMode1[i&3].max_lod + 0xf) / 0x10,
(tex.texImage1[i&3].image_type != 0));
if (tentry) if (tentry)
{ {