Make sure to rebind a texture after changing it.

This commit is contained in:
Unknown W. Brackets 2014-05-27 02:00:49 -07:00
parent 3e24786eab
commit ba2cf4f1d9
2 changed files with 11 additions and 5 deletions

View file

@ -784,7 +784,7 @@ void FramebufferManager::DoSetRenderFrameBuffer() {
// None found? Create one.
if (!vfb) {
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
textureCache_->ForgetLastTexture();
vfb = new VirtualFramebuffer();
vfb->fbo = 0;
vfb->fb_address = fb_address;
@ -891,7 +891,7 @@ void FramebufferManager::DoSetRenderFrameBuffer() {
// Use it as a render target.
DEBUG_LOG(SCEGE, "Switching render target to FBO for %08x: %i x %i x %i ", vfb->fb_address, vfb->width, vfb->height, vfb->format);
vfb->usageFlags |= FB_USAGE_RENDERTARGET;
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
textureCache_->ForgetLastTexture();
vfb->last_frame_render = gpuStats.numFlips;
frameLastFramebufUsed = gpuStats.numFlips;
vfb->dirtyAfterDisplay = true;
@ -1248,7 +1248,7 @@ void FramebufferManager::ReadFramebufferToMemory(VirtualFramebuffer *vfb, bool s
glEnable(GL_DITHER);
} else {
nvfb->usageFlags |= FB_USAGE_RENDERTARGET;
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
textureCache_->ForgetLastTexture();
nvfb->last_frame_render = gpuStats.numFlips;
nvfb->dirtyAfterDisplay = true;
@ -1392,6 +1392,7 @@ void FramebufferManager::BlitFramebuffer_(VirtualFramebuffer *dst, int dstX, int
float srcH = src->height;
DrawActiveTexture(0, dstX, dstY, w, h, dst->width, dst->height, false, srcX / srcW, srcY / srcH, (srcX + w) / srcW, (srcY + h) / srcH, draw2dprogram_);
glBindTexture(GL_TEXTURE_2D, 0);
textureCache_->ForgetLastTexture();
}
glstate.scissorTest.restore();
@ -1923,7 +1924,7 @@ bool FramebufferManager::NotifyFramebufferCopy(u32 src, u32 dst, int size) {
fbo_unbind();
}
glstate.viewport.restore();
gstate_c.textureChanged = TEXCHANGE_PARAMSONLY;
textureCache_->ForgetLastTexture();
// This is a memcpy, let's still copy just in case.
return false;
}
@ -2057,7 +2058,7 @@ void FramebufferManager::NotifyBlockTransferAfter(u32 dstBasePtr, int dstStride,
fbo_unbind();
}
glstate.viewport.restore();
gstate_c.textureChanged = TEXCHANGE_PARAMSONLY;
textureCache_->ForgetLastTexture();
}
}
}

View file

@ -65,6 +65,11 @@ public:
return cache.size();
}
void ForgetLastTexture() {
lastBoundTexture = -1;
gstate_c.textureChanged |= TEXCHANGE_PARAMSONLY;
}
// Only used by Qt UI?
bool DecodeTexture(u8 *output, GPUgstate state);