mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Invalidate FBOs when it's obvious they should be.
This fixes videos not being visible in for example Star Ocean. Most likely any games doing a copy directly from the mpeg decode.
This commit is contained in:
parent
f628b4319f
commit
dbb2dfdcff
4 changed files with 43 additions and 1 deletions
|
@ -16,6 +16,7 @@
|
|||
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
|
||||
|
||||
#include "Globals.h"
|
||||
#include "Core/Reporting.h"
|
||||
#include "Core/HLE/HLE.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "GPU/GPUState.h"
|
||||
|
@ -32,7 +33,12 @@ u32 sceDmacMemcpy(u32 dst, u32 src, u32 size)
|
|||
|
||||
Memory::Memcpy(dst, Memory::GetPointer(src), size);
|
||||
|
||||
gpu->InvalidateCache(dst, size, GPU_INVALIDATE_HINT);
|
||||
src &= ~0x40000000;
|
||||
// TODO: If we do this it'll probably black out the framebuffer?
|
||||
if (src < PSP_GetVidMemBase() || src > PSP_GetVidMemEnd())
|
||||
gpu->InvalidateCache(dst, size, GPU_INVALIDATE_HINT);
|
||||
else
|
||||
WARN_LOG_REPORT(HLE, "sceDmacMemcpy(): FBO blit?");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1024,6 +1024,9 @@ void GLES_GPU::InvalidateCache(u32 addr, int size, GPUInvalidationType type) {
|
|||
textureCache_.Invalidate(addr, size, type);
|
||||
else
|
||||
textureCache_.InvalidateAll(type);
|
||||
|
||||
if (type != GPU_INVALIDATE_ALL)
|
||||
framebufferManager_.UpdateFromMemory(addr, size);
|
||||
}
|
||||
|
||||
void GLES_GPU::ClearCacheNextFrame() {
|
||||
|
|
|
@ -659,6 +659,38 @@ void FramebufferManager::DestroyAllFBOs() {
|
|||
vfbs_.clear();
|
||||
}
|
||||
|
||||
void FramebufferManager::UpdateFromMemory(u32 addr, int size) {
|
||||
addr &= ~0x40000000;
|
||||
|
||||
// TODO: Could go through all FBOs, but probably not important?
|
||||
// TODO: Could also check for inner changes, but video is most important.
|
||||
if (addr == DisplayFramebufAddr() || addr == PrevDisplayFramebufAddr()) {
|
||||
// TODO: Deleting the FBO is a heavy hammer solution, so let's only do it if it'd help.
|
||||
if (!Memory::IsValidAddress(displayFramebufPtr_))
|
||||
return;
|
||||
|
||||
fbo_unbind();
|
||||
for (auto iter = vfbs_.begin(); iter != vfbs_.end(); ) {
|
||||
VirtualFramebuffer *vfb = *iter;
|
||||
if (MaskedEqual(vfb->fb_address, addr)) {
|
||||
// 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
|
||||
//DrawPixels(Memory::GetPointer(addr), vfb->format, vfb->fb_stride);
|
||||
textureCache_->NotifyFramebufferDestroyed(vfb->fb_address, vfb);
|
||||
INFO_LOG(HLE, "Invalidating FBO for %08x (%i x %i x %i)", vfb->fb_address, vfb->width, vfb->height, vfb->format)
|
||||
if (vfb->fbo) {
|
||||
fbo_destroy(vfb->fbo);
|
||||
vfb->fbo = 0;
|
||||
}
|
||||
delete vfb;
|
||||
vfbs_.erase(iter++);
|
||||
}
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FramebufferManager::Resized() {
|
||||
resized_ = true;
|
||||
}
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
void Resized();
|
||||
void CopyDisplayToOutput();
|
||||
void SetRenderFrameBuffer(); // Uses parameters computed from gstate
|
||||
void UpdateFromMemory(u32 addr, int size);
|
||||
// TODO: Break out into some form of FBO manager
|
||||
VirtualFramebuffer *GetDisplayFBO();
|
||||
void SetDisplayFramebuffer(u32 framebuf, u32 stride, int format);
|
||||
|
|
Loading…
Add table
Reference in a new issue