Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validate framebuffer uploads a bit more #6378

Merged
merged 2 commits into from
Jun 21, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions GPU/GLES/Framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,17 +982,16 @@ void FramebufferManager::DoSetRenderFrameBuffer() {

u32 byteSize = FramebufferByteSize(vfb);
u32 fb_address_mem = (fb_address & 0x3FFFFFFF) | 0x04000000;
if (fb_address_mem + byteSize > framebufRangeEnd_) {
if (Memory::IsVRAMAddress(fb_address_mem) && fb_address_mem + byteSize > framebufRangeEnd_) {
framebufRangeEnd_ = fb_address_mem + byteSize;
}

// Some AMD drivers crash if we don't clear the buffer first?
ClearBuffer();
if (useBufferedRendering_ && !updateVRAM_) {
gpu->PerformMemoryUpload(fb_address_mem, byteSize);
gpu->PerformStencilUpload(fb_address_mem, byteSize);
// TODO: Is it worth trying to upload the depth buffer?
ClearDepthBuffer();
} else {
ClearBuffer();
}

// Let's check for depth buffer overlap. Might be interesting.
Expand Down
10 changes: 8 additions & 2 deletions GPU/GLES/GLES_GPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2061,13 +2061,19 @@ bool GLES_GPU::PerformMemorySet(u32 dest, u8 v, int size) {
bool GLES_GPU::PerformMemoryDownload(u32 dest, int size) {
// Cheat a bit to force a download of the framebuffer.
// VRAM + 0x00400000 is simply a VRAM mirror.
return gpu->PerformMemoryCopy(dest ^ 0x00400000, dest, size);
if (Memory::IsVRAMAddress(dest)) {
return gpu->PerformMemoryCopy(dest ^ 0x00400000, dest, size);
}
return false;
}

bool GLES_GPU::PerformMemoryUpload(u32 dest, int size) {
// Cheat a bit to force an upload of the framebuffer.
// VRAM + 0x00400000 is simply a VRAM mirror.
return gpu->PerformMemoryCopy(dest, dest ^ 0x00400000, size);
if (Memory::IsVRAMAddress(dest)) {
return gpu->PerformMemoryCopy(dest, dest ^ 0x00400000, size);
}
return false;
}

bool GLES_GPU::PerformStencilUpload(u32 dest, int size) {
Expand Down