mirror of
https://github.com/blawar/GLideN64.git
synced 2024-07-04 10:03:36 +00:00
Ask for current texture alignment in TextureCache::init().
This commit is contained in:
parent
669976d468
commit
4f338b96c8
12
Textures.cpp
12
Textures.cpp
|
@ -462,6 +462,8 @@ void TextureCache::init()
|
|||
m_pDummy->textureBytes = 2*2*4;
|
||||
m_pDummy->tMem = 0;
|
||||
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &m_curUnpackAlignment);
|
||||
|
||||
glBindTexture( GL_TEXTURE_2D, m_pDummy->glName );
|
||||
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, dummyTexture );
|
||||
|
||||
|
@ -745,9 +747,6 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
}
|
||||
}
|
||||
|
||||
GLint curUnpackAlignment;
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &curUnpackAlignment);
|
||||
|
||||
bool bLoaded = false;
|
||||
if ((config.textureFilter.txEnhancementMode | config.textureFilter.txFilterMode) != 0 && config.textureFilter.txFilterIgnoreBG == 0 && TFH.isInited()) {
|
||||
GHQTexInfo ghqTexInfo;
|
||||
|
@ -764,7 +763,7 @@ void TextureCache::_loadBackground(CachedTexture *pTexture)
|
|||
glPixelStorei(GL_UNPACK_ALIGNMENT, 2);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, glInternalFormat, pTexture->realWidth, pTexture->realHeight, 0, GL_RGBA, glType, pDest);
|
||||
}
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, curUnpackAlignment);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, m_curUnpackAlignment);
|
||||
free(pDest);
|
||||
}
|
||||
|
||||
|
@ -864,9 +863,6 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
|
||||
line = tmptex.line;
|
||||
|
||||
GLint curUnpackAlignment;
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &curUnpackAlignment);
|
||||
|
||||
while (true) {
|
||||
if (tmptex.maskS > 0) {
|
||||
clampSClamp = tmptex.clampS ? tmptex.clampWidth - 1 : (tmptex.mirrorS ? (tmptex.width << 1) - 1 : tmptex.width - 1);
|
||||
|
@ -1000,7 +996,7 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture)
|
|||
tmptex.realHeight >>= 1;
|
||||
_pTexture->textureBytes += (tmptex.realWidth * tmptex.realHeight) << sizeShift;
|
||||
};
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, curUnpackAlignment);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, m_curUnpackAlignment);
|
||||
free(pDest);
|
||||
}
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ struct TextureCache
|
|||
static TextureCache & get();
|
||||
|
||||
private:
|
||||
TextureCache() : m_pDummy(NULL), m_hits(0), m_misses(0), m_maxBytes(0), m_cachedBytes(0)
|
||||
TextureCache() : m_pDummy(NULL), m_hits(0), m_misses(0), m_maxBytes(0), m_cachedBytes(0), m_curUnpackAlignment(4)
|
||||
{
|
||||
current[0] = NULL;
|
||||
current[1] = NULL;
|
||||
|
@ -84,6 +84,7 @@ private:
|
|||
u32 m_hits, m_misses;
|
||||
u32 m_maxBytes;
|
||||
u32 m_cachedBytes;
|
||||
GLint m_curUnpackAlignment;
|
||||
};
|
||||
|
||||
inline TextureCache & textureCache()
|
||||
|
|
Loading…
Reference in New Issue
Block a user