diff --git a/Config.h b/Config.h index 4068fde3..d0035a7f 100644 --- a/Config.h +++ b/Config.h @@ -25,6 +25,7 @@ struct Config struct { u32 maxAnisotropy; + f32 maxAnisotropyF; u32 forceBilinear; u32 maxBytes; u32 screenShotFormat; diff --git a/OpenGL.cpp b/OpenGL.cpp index 40e7310d..dd29f525 100644 --- a/OpenGL.cpp +++ b/OpenGL.cpp @@ -1234,6 +1234,12 @@ void OGLRender::_initExtensions() #else m_bImageTexture = false; #endif + + if (config.texture.maxAnisotropy != 0) { + glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &config.texture.maxAnisotropyF); + config.texture.maxAnisotropyF = min(config.texture.maxAnisotropyF, (f32)config.texture.maxAnisotropy); + } else + config.texture.maxAnisotropyF = 0.0f; } void OGLRender::_initStates() diff --git a/Textures.cpp b/Textures.cpp index 830f1208..a18e3bf2 100644 --- a/Textures.cpp +++ b/Textures.cpp @@ -1126,6 +1126,9 @@ void TextureCache::activateTexture(u32 _t, CachedTexture *_pTexture) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, _pTexture->clampS ? GL_CLAMP_TO_EDGE : _pTexture->mirrorS ? GL_MIRRORED_REPEAT : GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, _pTexture->clampT ? GL_CLAMP_TO_EDGE : _pTexture->mirrorT ? GL_MIRRORED_REPEAT : GL_REPEAT); + if (video().getRender().getRenderState() == OGLRender::rsTriangle && config.texture.maxAnisotropyF > 0.0f) + glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, config.texture.maxAnisotropyF); + _pTexture->lastDList = RSP.DList; current[_t] = _pTexture; diff --git a/mupenplus/Config_mupenplus.cpp b/mupenplus/Config_mupenplus.cpp index 49f7cf3a..534a906b 100644 --- a/mupenplus/Config_mupenplus.cpp +++ b/mupenplus/Config_mupenplus.cpp @@ -49,6 +49,8 @@ bool Config_SetDefault() //#Texture Settings res = ConfigSetDefaultBool(g_configVideoGliden64, "ForceBilinear", 0, "Force bilinear texture filter"); assert(res == M64ERR_SUCCESS); + res = ConfigSetDefaultBool(g_configVideoGliden64, "MaxAnisotropy", 0, "Max level of Anisotropic Filtering, 0 for off"); + assert(res == M64ERR_SUCCESS); res = ConfigSetDefaultInt(g_configVideoGliden64, "CacheSize", 500, "Size of texture cache in megabytes. Good value is VRAM*3/4"); assert(res == M64ERR_SUCCESS); //#Emulation Settings @@ -137,6 +139,7 @@ void Config_LoadConfig() //#Texture Settings config.texture.forceBilinear = ConfigGetParamBool(g_configVideoGliden64, "ForceBilinear"); + config.texture.maxAnisotropy = ConfigGetParamInt(g_configVideoGliden64, "MaxAnisotropy"); config.texture.maxBytes = ConfigGetParamInt(g_configVideoGliden64, "CacheSize") * uMegabyte; //#Emulation Settings config.generalEmulation.enableFog = ConfigGetParamBool(g_configVideoGliden64, "EnableFog");