Add option to set AnisotropyLevel , default 4

This commit is contained in:
raven02 2013-02-11 20:48:07 +08:00
parent aaa0b93161
commit 66417155c9
3 changed files with 8 additions and 1 deletions

View file

@ -67,6 +67,7 @@ void CConfig::Load(const char *iniFileName)
graphics->Get("LinearFiltering", &bLinearFiltering, false);
graphics->Get("SSAA", &SSAntiAliasing, 0);
graphics->Get("VBO", &bUseVBO, false);
graphics->Get("AnisotropyLevel", &iAnisotropyLevel, 4);
graphics->Get("DisableG3DLog", &bDisableG3DLog, false);
graphics->Get("VertexCache", &bVertexCache, true);
graphics->Get("FullScreen", &bFullScreen, false);
@ -123,6 +124,7 @@ void CConfig::Save()
graphics->Set("LinearFiltering", bLinearFiltering);
graphics->Set("SSAA", SSAntiAliasing);
graphics->Set("VBO", bUseVBO);
graphics->Set("AnisotropyLevel", iAnisotropyLevel);
graphics->Set("DisableG3DLog", bDisableG3DLog);
graphics->Set("VertexCache", bVertexCache);
graphics->Set("FullScreen", bFullScreen);

View file

@ -62,6 +62,7 @@ public:
bool bDisableG3DLog;
bool bVertexCache;
bool bFullScreen;
int iAnisotropyLevel;
// Sound
bool bEnableSound;

View file

@ -26,6 +26,7 @@
// If a texture hasn't been seen for 200 frames, get rid of it.
#define TEXTURE_KILL_AGE 200
float maxAnisotropyLevel ;
TextureCache::TextureCache() {
// TODO: Switch to aligned allocations for alignment. AllocateMemoryPages would do the trick.
@ -35,6 +36,7 @@ TextureCache::TextureCache() {
tmpTexBufRearrange = new u32[1024 * 512]; // 2MB
clutBuf32 = new u32[4096]; // 4K
clutBuf16 = new u16[4096]; // 4K
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &maxAnisotropyLevel);
}
TextureCache::~TextureCache() {
@ -857,7 +859,9 @@ void TextureCache::SetTexture() {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, entry->maxLevel);
#endif
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_LOD, (float)entry->maxLevel);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 4.0);
float anisotropyLevel = (float) g_Config.iAnisotropyLevel > maxAnisotropyLevel ? maxAnisotropyLevel : (float) g_Config.iAnisotropyLevel;
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropyLevel );
// NOTICE_LOG(G3D,"AnisotropyLevel = %0.1f , MaxAnisotropyLevel = %0.1f ", anisotropyLevel, maxAnisotropyLevel );
UpdateSamplingParams(*entry, true);