1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Remove redundunt glTexParameter calls.

This commit is contained in:
Sergey Lipskiy 2015-02-16 19:47:54 +06:00
parent cfabff544f
commit d9eab35441
2 changed files with 13 additions and 8 deletions

View File

@ -459,6 +459,8 @@ void TextureCache::init()
glBindTexture( GL_TEXTURE_2D, m_pDummy->glName );
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, dummyTexture );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
m_cachedBytes = m_pDummy->textureBytes;
activateDummy( 0 );
@ -1096,13 +1098,8 @@ u32 _calculateCRC(u32 t, const TextureParams & _params)
return crc;
}
void TextureCache::activateTexture(u32 _t, CachedTexture *_pTexture)
void TextureCache::_setTextureParameters(CachedTexture *_pTexture)
{
glActiveTexture(GL_TEXTURE0 + _t);
// Bind the cached texture
glBindTexture( GL_TEXTURE_2D, _pTexture->glName );
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, _pTexture->max_level);
// Set filter mode. Almost always bilinear, but check anyways
if ((gDP.otherMode.textureFilter == G_TF_BILERP) || (gDP.otherMode.textureFilter == G_TF_AVERAGE) || ((gSP.objRendermode&G_OBJRM_BILERP) != 0) || (config.texture.forceBilinear)) {
@ -1126,9 +1123,15 @@ void TextureCache::activateTexture(u32 _t, CachedTexture *_pTexture)
if (video().getRender().getRenderState() == OGLRender::rsTriangle && config.texture.maxAnisotropyF > 0.0f)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, config.texture.maxAnisotropyF);
}
void TextureCache::activateTexture(u32 _t, CachedTexture *_pTexture)
{
glActiveTexture(GL_TEXTURE0 + _t);
_pTexture->lastDList = RSP.DList;
// Bind the cached texture
glBindTexture( GL_TEXTURE_2D, _pTexture->glName );
current[_t] = _pTexture;
}
@ -1138,8 +1141,7 @@ void TextureCache::activateDummy(u32 _t)
glBindTexture( GL_TEXTURE_2D, m_pDummy->glName );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
current[_t] = m_pDummy;
}
void TextureCache::_updateBackground()
@ -1215,6 +1217,7 @@ void TextureCache::_updateBackground()
_loadBackground(pCurrent);
activateTexture(0, pCurrent);
_setTextureParameters(pCurrent);
m_cachedBytes += pCurrent->textureBytes;
current[0] = pCurrent;
@ -1361,6 +1364,7 @@ void TextureCache::update(u32 _t)
_load(_t, pCurrent);
activateTexture( _t, pCurrent );
_setTextureParameters(pCurrent);
m_cachedBytes += pCurrent->textureBytes;
current[_t] = pCurrent;

View File

@ -74,6 +74,7 @@ private:
void _checkCacheSize();
CachedTexture * _addTexture(u32 _crc32);
void _setTextureParameters(CachedTexture *_pTexture);
void _load(u32 _tile, CachedTexture *_pTexture);
bool _loadHiresTexture(u32 _tile, CachedTexture *_pTexture);
void _loadBackground(CachedTexture *pTexture);