Consistently mark vfb dirty after drawing to it.

This commit is contained in:
Unknown W. Brackets 2014-06-14 13:19:27 -07:00
parent 59bef47035
commit d06a0520ae
2 changed files with 14 additions and 18 deletions

View file

@ -934,10 +934,7 @@ void FramebufferManager::DoSetRenderFrameBuffer() {
vfb->bufferHeight = drawing_height; vfb->bufferHeight = drawing_height;
vfb->format = fmt; vfb->format = fmt;
vfb->usageFlags = FB_USAGE_RENDERTARGET; vfb->usageFlags = FB_USAGE_RENDERTARGET;
vfb->dirtyAfterDisplay = true; SetColorUpdated(vfb);
if ((gstate_c.skipDrawReason & SKIPDRAW_SKIPFRAME) == 0)
vfb->reallyDirtyAfterDisplay = true;
vfb->memoryUpdated = false;
vfb->depthUpdated = false; vfb->depthUpdated = false;
ResizeFramebufFBO(vfb, drawing_width, drawing_height, true); ResizeFramebufFBO(vfb, drawing_width, drawing_height, true);
@ -1979,8 +1976,6 @@ void FramebufferManager::UpdateFromMemory(u32 addr, int size, bool safe) {
FlushBeforeCopy(); FlushBeforeCopy();
fbo_unbind(); fbo_unbind();
vfb->dirtyAfterDisplay = true;
vfb->reallyDirtyAfterDisplay = true;
// TODO: This without the fbo_unbind() above would be better than destroying the FBO. // TODO: This without the fbo_unbind() above would be better than destroying the FBO.
// However, it doesn't seem to work for Star Ocean, at least // However, it doesn't seem to work for Star Ocean, at least
if (useBufferedRendering_ && vfb->fbo) { if (useBufferedRendering_ && vfb->fbo) {
@ -1994,7 +1989,7 @@ void FramebufferManager::UpdateFromMemory(u32 addr, int size, bool safe) {
fmt = displayFormat_; fmt = displayFormat_;
} }
DrawPixels(vfb, 0, 0, Memory::GetPointer(addr | 0x04000000), fmt, vfb->fb_stride, vfb->width, vfb->height); DrawPixels(vfb, 0, 0, Memory::GetPointer(addr | 0x04000000), fmt, vfb->fb_stride, vfb->width, vfb->height);
vfb->memoryUpdated = false; SetColorUpdated(vfb);
} else { } else {
INFO_LOG(SCEGE, "Invalidating FBO for %08x (%i x %i x %i)", vfb->fb_address, vfb->width, vfb->height, vfb->format) INFO_LOG(SCEGE, "Invalidating FBO for %08x (%i x %i x %i)", vfb->fb_address, vfb->width, vfb->height, vfb->format)
DestroyFramebuf(vfb); DestroyFramebuf(vfb);
@ -2095,9 +2090,7 @@ bool FramebufferManager::NotifyFramebufferCopy(u32 src, u32 dst, int size, bool
} }
glViewport(0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight); glViewport(0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight);
DrawPixels(dstBuffer, 0, dstY, srcBase, dstBuffer->format, dstBuffer->fb_stride, dstBuffer->width, dstH); DrawPixels(dstBuffer, 0, dstY, srcBase, dstBuffer->format, dstBuffer->fb_stride, dstBuffer->width, dstH);
dstBuffer->dirtyAfterDisplay = true; SetColorUpdated(dstBuffer);
if ((gstate_c.skipDrawReason & SKIPDRAW_SKIPFRAME) == 0)
dstBuffer->reallyDirtyAfterDisplay = true;
if (useBufferedRendering_) { if (useBufferedRendering_) {
RebindFramebuffer(); RebindFramebuffer();
} else { } else {
@ -2105,7 +2098,6 @@ bool FramebufferManager::NotifyFramebufferCopy(u32 src, u32 dst, int size, bool
} }
glstate.viewport.restore(); glstate.viewport.restore();
textureCache_->ForgetLastTexture(); textureCache_->ForgetLastTexture();
dstBuffer->memoryUpdated = false;
// This is a memcpy, let's still copy just in case. // This is a memcpy, let's still copy just in case.
return false; return false;
} }
@ -2246,7 +2238,7 @@ bool FramebufferManager::NotifyBlockTransferBefore(u32 dstBasePtr, int dstStride
BlitFramebuffer_(&tempBuffer, srcX, srcY, dstBuffer, srcX, srcY, dstWidth, dstHeight, bpp); BlitFramebuffer_(&tempBuffer, srcX, srcY, dstBuffer, srcX, srcY, dstWidth, dstHeight, bpp);
BlitFramebuffer_(dstBuffer, dstX, dstY, &tempBuffer, srcX, srcY, dstWidth, dstHeight, bpp); BlitFramebuffer_(dstBuffer, dstX, dstY, &tempBuffer, srcX, srcY, dstWidth, dstHeight, bpp);
RebindFramebuffer(); RebindFramebuffer();
dstBuffer->memoryUpdated = false; SetColorUpdated(dstBuffer);
return true; return true;
} }
} else { } else {
@ -2262,7 +2254,7 @@ bool FramebufferManager::NotifyBlockTransferBefore(u32 dstBasePtr, int dstStride
FlushBeforeCopy(); FlushBeforeCopy();
BlitFramebuffer_(dstBuffer, dstX, dstY, srcBuffer, srcX, srcY, dstWidth, dstHeight, bpp); BlitFramebuffer_(dstBuffer, dstX, dstY, srcBuffer, srcX, srcY, dstWidth, dstHeight, bpp);
RebindFramebuffer(); RebindFramebuffer();
dstBuffer->memoryUpdated = false; SetColorUpdated(dstBuffer);
return true; // No need to actually do the memory copy behind, probably. return true; // No need to actually do the memory copy behind, probably.
} }
} }
@ -2324,9 +2316,7 @@ void FramebufferManager::NotifyBlockTransferAfter(u32 dstBasePtr, int dstStride,
float dstXFactor = (float)bpp / dstBpp; float dstXFactor = (float)bpp / dstBpp;
glViewport(0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight); glViewport(0, 0, dstBuffer->renderWidth, dstBuffer->renderHeight);
DrawPixels(dstBuffer, dstX * dstXFactor, dstY, srcBase, dstBuffer->format, srcStride * dstXFactor, dstWidth * dstXFactor, dstHeight); DrawPixels(dstBuffer, dstX * dstXFactor, dstY, srcBase, dstBuffer->format, srcStride * dstXFactor, dstWidth * dstXFactor, dstHeight);
dstBuffer->dirtyAfterDisplay = true; SetColorUpdated(dstBuffer);
if ((gstate_c.skipDrawReason & SKIPDRAW_SKIPFRAME) == 0)
dstBuffer->reallyDirtyAfterDisplay = true;
if (useBufferedRendering_) { if (useBufferedRendering_) {
RebindFramebuffer(); RebindFramebuffer();
} else { } else {
@ -2334,7 +2324,6 @@ void FramebufferManager::NotifyBlockTransferAfter(u32 dstBasePtr, int dstStride,
} }
glstate.viewport.restore(); glstate.viewport.restore();
textureCache_->ForgetLastTexture(); textureCache_->ForgetLastTexture();
dstBuffer->memoryUpdated = false;
} }
} }
} }

View file

@ -208,7 +208,7 @@ public:
} }
void SetColorUpdated() { void SetColorUpdated() {
if (currentRenderVfb_) { if (currentRenderVfb_) {
currentRenderVfb_->memoryUpdated = false; SetColorUpdated(currentRenderVfb_);
} }
} }
@ -252,6 +252,13 @@ private:
static void ClearBuffer(); static void ClearBuffer();
static bool MaskedEqual(u32 addr1, u32 addr2); static bool MaskedEqual(u32 addr1, u32 addr2);
void SetColorUpdated(VirtualFramebuffer *dstBuffer) {
dstBuffer->memoryUpdated = false;
dstBuffer->dirtyAfterDisplay = true;
if ((gstate_c.skipDrawReason & SKIPDRAW_SKIPFRAME) == 0)
dstBuffer->reallyDirtyAfterDisplay = true;
}
u32 displayFramebufPtr_; u32 displayFramebufPtr_;
u32 displayStride_; u32 displayStride_;
GEBufferFormat displayFormat_; GEBufferFormat displayFormat_;