mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Schedule the FBO blit during multithreading.
This was it's properly ordered with draws, and it runs on the right GL context.
This commit is contained in:
parent
9894b38a1d
commit
e4dc702d68
3 changed files with 31 additions and 4 deletions
|
@ -661,6 +661,10 @@ void GLES_GPU::ProcessEvent(GPUEvent ev) {
|
|||
InvalidateCacheInternal(ev.invalidate_cache.addr, ev.invalidate_cache.size, ev.invalidate_cache.type);
|
||||
break;
|
||||
|
||||
case GPU_EVENT_FB_MEMCPY:
|
||||
UpdateMemoryInternal(ev.fb_memcpy.dst, ev.fb_memcpy.src, ev.fb_memcpy.size);
|
||||
break;
|
||||
|
||||
default:
|
||||
GPUCommon::ProcessEvent(ev);
|
||||
}
|
||||
|
@ -1964,14 +1968,29 @@ void GLES_GPU::InvalidateCacheInternal(u32 addr, int size, GPUInvalidationType t
|
|||
}
|
||||
}
|
||||
|
||||
void GLES_GPU::UpdateMemoryInternal(u32 dest, u32 src, int size) {
|
||||
if (!framebufferManager_.NotifyFramebufferCopy(src, dest, size)) {
|
||||
Memory::Memcpy(dest, Memory::GetPointer(src), size);
|
||||
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
|
||||
} else {
|
||||
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
|
||||
}
|
||||
}
|
||||
|
||||
bool GLES_GPU::UpdateMemory(u32 dest, u32 src, int size) {
|
||||
// Track stray copies of a framebuffer in RAM. MotoGP does this.
|
||||
if (framebufferManager_.MayIntersectFramebuffer(src) || framebufferManager_.MayIntersectFramebuffer(dest)) {
|
||||
if (!framebufferManager_.NotifyFramebufferCopy(src, dest, size)) {
|
||||
Memory::Memcpy(dest, Memory::GetPointer(src), size);
|
||||
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
|
||||
if (IsOnSeparateCPUThread()) {
|
||||
GPUEvent ev(GPU_EVENT_FB_MEMCPY);
|
||||
ev.fb_memcpy.dst = dest;
|
||||
ev.fb_memcpy.src = src;
|
||||
ev.fb_memcpy.size = size;
|
||||
ScheduleEvent(ev);
|
||||
|
||||
// This is a memcpy, so we need to wait for it to complete.
|
||||
SyncThread();
|
||||
} else {
|
||||
InvalidateCache(dest, size, GPU_INVALIDATE_HINT);
|
||||
UpdateMemoryInternal(dest, src, size);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -151,6 +151,7 @@ private:
|
|||
void InitClearInternal();
|
||||
void BeginFrameInternal();
|
||||
void CopyDisplayToOutputInternal();
|
||||
void UpdateMemoryInternal(u32 dest, u32 src, int size);
|
||||
void InvalidateCacheInternal(u32 addr, int size, GPUInvalidationType type);
|
||||
|
||||
static CommandInfo cmdInfo_[256];
|
||||
|
|
|
@ -163,6 +163,7 @@ enum GPUEventType {
|
|||
GPU_EVENT_INVALIDATE_CACHE,
|
||||
GPU_EVENT_FINISH_EVENT_LOOP,
|
||||
GPU_EVENT_SYNC_THREAD,
|
||||
GPU_EVENT_FB_MEMCPY,
|
||||
};
|
||||
|
||||
struct GPUEvent {
|
||||
|
@ -175,6 +176,12 @@ struct GPUEvent {
|
|||
int size;
|
||||
GPUInvalidationType type;
|
||||
} invalidate_cache;
|
||||
// GPU_EVENT_FB_MEMCPY
|
||||
struct {
|
||||
u32 dst;
|
||||
u32 src;
|
||||
int size;
|
||||
} fb_memcpy;
|
||||
};
|
||||
|
||||
operator GPUEventType() const {
|
||||
|
|
Loading…
Add table
Reference in a new issue