Support memsets of framebuffers as uploads.

Technically should clear stencil too... maybe it'd be better to handle
separately.
This commit is contained in:
Unknown W. Brackets 2014-05-26 14:18:06 -07:00
parent 95003cb77d
commit 64f6012dba
3 changed files with 9 additions and 7 deletions

View file

@ -168,12 +168,9 @@ static int Replace_memset() {
u8 *dst = Memory::GetPointerUnchecked(destPtr);
u8 value = PARAM(1);
u32 bytes = PARAM(2);
bool skip = false;
if (Memory::IsVRAMAddress(destPtr) || Memory::IsVRAMAddress(destPtr)) {
skip = gpu->UpdateMemory(destPtr, destPtr, bytes);
}
if (!skip) {
memset(dst, value, bytes);
if (Memory::IsVRAMAddress(destPtr)) {
gpu->UpdateMemory(destPtr, destPtr, bytes);
}
RETURN(destPtr);
#ifndef MOBILE_DEVICE

View file

@ -553,6 +553,9 @@ u32 sceKernelMemset(u32 addr, u32 fillc, u32 n)
u8 c = fillc & 0xff;
DEBUG_LOG(SCEINTC, "sceKernelMemset(ptr = %08x, c = %02x, n = %08x)", addr, c, n);
Memory::Memset(addr, c, n);
if (Memory::IsVRAMAddress(addr)) {
gpu->UpdateMemory(addr, addr, n);
}
return addr;
}

View file

@ -1880,9 +1880,11 @@ bool FramebufferManager::NotifyFramebufferCopy(u32 src, u32 dst, int size) {
}
}
bool actuallyMemset = src == dst;
// TODO: Do ReadFramebufferToMemory etc where applicable.
// This will slow down MotoGP but make the hack above unnecessary.
if (dstBuffer && srcBuffer) {
if (dstBuffer && srcBuffer && !actuallyMemset) {
if (srcBuffer == dstBuffer) {
WARN_LOG_REPORT_ONCE(dstsrccpy, G3D, "Intra-buffer memcpy (not supported) %08x -> %08x", src, dst);
} else {