From ea4d174e5cf036fb7a9589d104135ed63f38037b Mon Sep 17 00:00:00 2001 From: Sergey Lipskiy Date: Thu, 26 Jan 2017 21:36:54 +0700 Subject: [PATCH] Correct texture initialization. --- src/FrameBuffer.cpp | 1 + src/Textures.cpp | 14 ++------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/src/FrameBuffer.cpp b/src/FrameBuffer.cpp index a8479d2c..a3d83f67 100644 --- a/src/FrameBuffer.cpp +++ b/src/FrameBuffer.cpp @@ -89,6 +89,7 @@ void FrameBuffer::_setAndAttachTexture(ObjectHandle _fbo, CachedTexture *_pTextu const FramebufferTextureFormats & fbTexFormat = gfxContext.getFramebufferTextureFormats(); Context::InitTextureParams params; params.handle = _pTexture->name; + params.textureUnitIndex = textureIndices::Tex[_t]; if (_multisampling) params.msaaLevel = config.video.multisampling; params.width = _pTexture->realWidth; diff --git a/src/Textures.cpp b/src/Textures.cpp index 55ff9ba8..33a16a23 100644 --- a/src/Textures.cpp +++ b/src/Textures.cpp @@ -1157,6 +1157,7 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture) &ghqTexInfo) != 0 && ghqTexInfo.data != nullptr) { Context::InitTextureParams params; params.handle = _pTexture->name; + params.textureUnitIndex = textureIndices::Tex[_tile]; params.mipMapLevel = 0; params.msaaLevel = 0; params.width = ghqTexInfo.width; @@ -1177,6 +1178,7 @@ void TextureCache::_load(u32 _tile, CachedTexture *_pTexture) gfxContext.setTextureUnpackAlignment(2); Context::InitTextureParams params; params.handle = _pTexture->name; + params.textureUnitIndex = textureIndices::Tex[_tile]; params.mipMapLevel = mipLevel; params.mipMapLevels = _pTexture->max_level + 1; params.msaaLevel = 0; @@ -1383,12 +1385,6 @@ void TextureCache::_updateBackground() CachedTexture * pCurrent = _addTexture(crc); - Context::BindTextureParameters bindParams; - bindParams.target = target::TEXTURE_2D; - bindParams.texture = pCurrent->name; - bindParams.textureUnitIndex = textureIndices::Tex[0]; - gfxContext.bindTexture(bindParams); - pCurrent->address = gSP.bgImage.address; pCurrent->format = gSP.bgImage.format; @@ -1535,12 +1531,6 @@ void TextureCache::update(u32 _t) CachedTexture * pCurrent = _addTexture(crc); - Context::BindTextureParameters bindParams; - bindParams.target = target::TEXTURE_2D; - bindParams.texture = pCurrent->name; - bindParams.textureUnitIndex = textureIndices::Tex[_t]; - gfxContext.bindTexture(bindParams); - pCurrent->address = gDP.loadInfo[pTile->tmem].texAddress; pCurrent->format = pTile->format;