Skip to content

Commit

Permalink
Merge branch 'patch-8' of https://github.com/raven02/ppsspp into rave…
Browse files Browse the repository at this point in the history
…n02-patch-8
  • Loading branch information
hrydgard committed Jul 7, 2013
2 parents b581b73 + 8cf50d6 commit 76c3f16
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions GPU/GLES/Framebuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,22 +377,21 @@ void GetViewportDimensions(int &w, int &h) {
void GuessDrawingSize(int &drawing_width, int &drawing_height) {
GetViewportDimensions(drawing_width, drawing_height);

// HACK for first frame where some games don't init things right
if (drawing_width <= 1 && drawing_height <= 1) {
drawing_width = 480;
drawing_height = 272;
}

// Now, cap using scissor. Hm, no, this doesn't work so well.
/*
if (drawing_width > gstate.getScissorX2() + 1)
drawing_width = gstate.getScissorX2() + 1;
if (drawing_height > gstate.getScissorY2() + 1)
drawing_height = gstate.getScissorY2() + 1;*/

// Cap at maximum texture size for now. Don't see much point in drawing bigger.
drawing_width = std::min(drawing_width, 512);
drawing_height = std::min(drawing_height, 512);
// Bit hacky but it works pretty well
if (!g_Config.bBufferedRendering || g_iNumVideos || (drawing_width <= 1 && drawing_height <= 1) ) {
drawing_width = 480;
drawing_height = 272;
} else {
drawing_width = std::max(drawing_width, 512);
drawing_height = std::max(drawing_height, 512);
}
}

void FramebufferManager::DestroyFramebuf(VirtualFramebuffer *v) {
Expand Down Expand Up @@ -430,21 +429,16 @@ void FramebufferManager::SetRenderFrameBuffer() {
int z_stride = gstate.zbwidth & 0x3C0;

// Yeah this is not completely right. but it'll do for now.
int drawing_width = ((gstate.region2) & 0x3FF) + 1;
int drawing_height = ((gstate.region2 >> 10) & 0x3FF) + 1;

if (drawing_width > gstate.getScissorX2() + 1)
drawing_width = gstate.getScissorX2() + 1;
if (drawing_height > gstate.getScissorY2() + 1)
drawing_height = gstate.getScissorY2() + 1;
//int drawing_width = ((gstate.region2) & 0x3FF) + 1;
//int drawing_height = ((gstate.region2 >> 10) & 0x3FF) + 1;

// As there are no clear "framebuffer width" and "framebuffer height" registers,
// we need to infer the size of the current framebuffer somehow. Let's try the viewport.

int fmt = gstate.framebufpixformat & 3;

//int drawing_width, drawing_height;
//GuessDrawingSize(drawing_width, drawing_height);
int drawing_width, drawing_height;
GuessDrawingSize(drawing_width, drawing_height);

int buffer_width = drawing_width;
int buffer_height = drawing_height;
Expand Down

0 comments on commit 76c3f16

Please sign in to comment.