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

Attempt to go back to the earliest logic of finding a matching framebuffer #4399

Merged
merged 1 commit into from
Nov 4, 2013
Merged
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
38 changes: 8 additions & 30 deletions GPU/GLES/Framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,39 +659,17 @@ void FramebufferManager::SetRenderFrameBuffer() {
int buffer_width = drawing_width;
int buffer_height = drawing_height;

// Find a matching framebuffer, same size or bigger
// Find a matching framebuffer
VirtualFramebuffer *vfb = 0;
for (size_t i = 0; i < vfbs_.size(); ++i) {
VirtualFramebuffer *v = vfbs_[i];
if (MaskedEqual(v->fb_address, fb_address)) {
// Okay, let's check the sizes. If the new one is bigger than the old one, recreate.
// If the opposite, just use it and hope that the game sets scissors accordingly.
if (v->bufferWidth >= drawing_width && v->bufferHeight >= drawing_height) {
// Let's not be so picky for now. Let's say this is the one.
vfb = v;
// Update fb stride in case it changed
vfb->fb_stride = fb_stride;
v->format = fmt;
// Just hack the width/height and we should be fine. also hack renderwidth/renderheight?
v->width = drawing_width;
v->height = drawing_height;
break;
} else {
INFO_LOG(HLE, "Enlarging framebuffer from (%i, %i) to (%i, %i)", (int)v->width, (int)v->height, drawing_width, drawing_height);
// drawing_width or drawing_height is bigger. Let's recreate with the max.
// To do this right we should copy the data over too, but meh.
if ((int)v->width >= drawing_width && (int)v->height >= drawing_height) {
buffer_width = (int)v->width;
buffer_height = (int)v->height;
} else {
buffer_width = drawing_width;
buffer_height = drawing_height;
}

DestroyFramebuf(v);
vfbs_.erase(vfbs_.begin() + i--);
break;
}
if (MaskedEqual(v->fb_address, fb_address) && v->width >= drawing_width && v->height >= drawing_height) {
// Let's not be so picky for now. Let's say this is the one.
vfb = v;
// Update fb stride in case it changed
vfb->fb_stride = fb_stride;
v->format = fmt;
break;
}
}

Expand Down