From 1261f5f7f4f15fba126119eda0d0639568e2b101 Mon Sep 17 00:00:00 2001 From: degasus Date: Sun, 11 Jan 2015 12:48:04 +0100 Subject: [PATCH] TextureCache: inline arguments into texture cache --- Source/Core/VideoCommon/TextureCacheBase.cpp | 16 +++++++++++++--- Source/Core/VideoCommon/TextureCacheBase.h | 3 +-- Source/Core/VideoCommon/VertexManagerBase.cpp | 10 +--------- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index 88737a1e95..561c3e24ea 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -290,10 +290,20 @@ static TextureCache::TCacheEntryBase* ReturnEntry(unsigned int stage, TextureCac return entry; } -TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const 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) +TextureCache::TCacheEntryBase* TextureCache::Load(const u32 stage) { + 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) return nullptr; diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index ae5e3be1ea..c803546d37 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -105,8 +105,7 @@ public: virtual void CompileShaders() = 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, - int format, unsigned int tlutaddr, int tlutfmt, bool use_mipmaps, unsigned int maxlevel, bool from_tmem); + static TCacheEntryBase* Load(const u32 stage); static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); diff --git a/Source/Core/VideoCommon/VertexManagerBase.cpp b/Source/Core/VideoCommon/VertexManagerBase.cpp index c6191a587f..38cfd19630 100644 --- a/Source/Core/VideoCommon/VertexManagerBase.cpp +++ b/Source/Core/VideoCommon/VertexManagerBase.cpp @@ -202,15 +202,7 @@ void VertexManager::Flush() for (unsigned int i : usedtextures) { g_renderer->SetSamplerState(i & 3, i >> 2); - const FourTexUnits &tex = bpmem.tex[i >> 2]; - 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)); + const TextureCache::TCacheEntryBase* tentry = TextureCache::Load(i); if (tentry) {