From 069d949a572ea2543e86819487c0ba34e5564af8 Mon Sep 17 00:00:00 2001 From: NeoBrainX Date: Fri, 10 Aug 2012 13:13:51 +0200 Subject: [PATCH] [cleanup] TextureCache: Kill the autogen_mipmap parameter --- Source/Core/VideoCommon/Src/TextureCacheBase.cpp | 6 +++--- Source/Core/VideoCommon/Src/TextureCacheBase.h | 2 +- .../Plugins/Plugin_VideoDX11/Src/TextureCache.cpp | 5 +---- Source/Plugins/Plugin_VideoDX11/Src/TextureCache.h | 2 +- Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp | 3 +-- Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h | 2 +- Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp | 13 ++----------- Source/Plugins/Plugin_VideoOGL/Src/TextureCache.h | 2 +- 8 files changed, 11 insertions(+), 24 deletions(-) diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp index 21e4a9d989..dc80d98639 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.cpp @@ -435,7 +435,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, else entry->type = TCET_NORMAL; // load texture - entry->Load(width, height, expandedWidth, 0, (texLevels == 0)); + entry->Load(width, height, expandedWidth, 0); if (g_ActiveConfig.bDumpTextures && !using_custom_texture) DumpTexture(entry, 0); @@ -470,7 +470,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, expandedHeight = (currentHeight + bsh) & (~bsh); TexDecoder_Decode(temp, *ptr, expandedWidth, expandedHeight, texformat, tlutaddr, tlutfmt, g_ActiveConfig.backend_info.bUseRGBATextures); - entry->Load(currentWidth, currentHeight, expandedWidth, level, false); + entry->Load(currentWidth, currentHeight, expandedWidth, level); if (g_ActiveConfig.bDumpTextures) DumpTexture(entry, level); @@ -493,7 +493,7 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int stage, unsigned int currentHeight = (mipHeight > 0) ? mipHeight : 1; LoadCustomTexture(tex_hash, texformat, level, currentWidth, currentHeight); - entry->Load(currentWidth, currentHeight, currentWidth, level, false); + entry->Load(currentWidth, currentHeight, currentWidth, level); mipWidth >>= 1; mipHeight >>= 1; diff --git a/Source/Core/VideoCommon/Src/TextureCacheBase.h b/Source/Core/VideoCommon/Src/TextureCacheBase.h index 7197a639a7..5d44341c7c 100644 --- a/Source/Core/VideoCommon/Src/TextureCacheBase.h +++ b/Source/Core/VideoCommon/Src/TextureCacheBase.h @@ -89,7 +89,7 @@ public: virtual bool Save(const char filename[], unsigned int level) = 0; virtual void Load(unsigned int width, unsigned int height, - unsigned int expanded_width, unsigned int level, bool autogen_mips) = 0; + unsigned int expanded_width, unsigned int level) = 0; virtual void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf, unsigned int cbufid, diff --git a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp index 5f82a18fc0..844cf24b47 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.cpp @@ -59,12 +59,9 @@ bool TextureCache::TCacheEntry::Save(const char filename[], unsigned int level) } void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height, - unsigned int expanded_width, unsigned int level, bool autogen_mips) + unsigned int expanded_width, unsigned int level) { D3D::ReplaceRGBATexture2D(texture->GetTex(), TextureCache::temp, width, height, expanded_width, level, usage); - - if (autogen_mips) - PD3DX11FilterTexture(D3D::context, texture->GetTex(), 0, D3DX11_DEFAULT); } TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width, diff --git a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.h b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.h index 59d343017c..7876cb79ee 100644 --- a/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.h +++ b/Source/Plugins/Plugin_VideoDX11/Src/TextureCache.h @@ -41,7 +41,7 @@ private: ~TCacheEntry(); void Load(unsigned int width, unsigned int height, - unsigned int expanded_width, unsigned int levels, bool autogen_mips = false); + unsigned int expanded_width, unsigned int levels); void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, const EFBRectangle& srcRect, diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp index 2be29048d3..660fad7379 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.cpp @@ -72,10 +72,9 @@ bool TextureCache::TCacheEntry::Save(const char filename[], unsigned int level) } void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height, - unsigned int expanded_width, unsigned int level, bool autogen_mips) + unsigned int expanded_width, unsigned int level) { D3D::ReplaceTexture2D(texture, temp, width, height, expanded_width, d3d_fmt, swap_r_b, level); - // D3D9 will automatically generate mip maps if necessary } void TextureCache::TCacheEntry::FromRenderTarget(u32 dstAddr, unsigned int dstFormat, diff --git a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h index 4a7cddd575..fc338e623f 100644 --- a/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h +++ b/Source/Plugins/Plugin_VideoDX9/Src/TextureCache.h @@ -44,7 +44,7 @@ private: ~TCacheEntry(); void Load(unsigned int width, unsigned int height, - unsigned int expanded_width, unsigned int levels, bool autogen_mips = false); + unsigned int expanded_width, unsigned int levels); void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, const EFBRectangle& srcRect, diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp index 7a62131f90..ab850d9af2 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.cpp @@ -201,7 +201,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width, } void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height, - unsigned int expanded_width, unsigned int level, bool autogen_mips) + unsigned int expanded_width, unsigned int level) { //glEnable(GL_TEXTURE_2D); glBindTexture(GL_TEXTURE_2D, texture); @@ -212,16 +212,7 @@ void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height, if (expanded_width != width) glPixelStorei(GL_UNPACK_ROW_LENGTH, expanded_width); - if (bHaveMipMaps && autogen_mips) - { - glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); - glTexImage2D(GL_TEXTURE_2D, level, gl_iformat, width, height, 0, gl_format, gl_type, temp); - glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_FALSE); - } - else - { - glTexImage2D(GL_TEXTURE_2D, level, gl_iformat, width, height, 0, gl_format, gl_type, temp); - } + glTexImage2D(GL_TEXTURE_2D, level, gl_iformat, width, height, 0, gl_format, gl_type, temp); if (expanded_width != width) glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); diff --git a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.h b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.h index 30f44b797d..a26aa4049e 100644 --- a/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.h +++ b/Source/Plugins/Plugin_VideoOGL/Src/TextureCache.h @@ -54,7 +54,7 @@ private: ~TCacheEntry(); void Load(unsigned int width, unsigned int height, - unsigned int expanded_width, unsigned int level, bool autogen_mips = false); + unsigned int expanded_width, unsigned int level); void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, unsigned int srcFormat, const EFBRectangle& srcRect,