Avoid framebuffer lookups for repeated prims.

There are usually many prims per framebuffer.  This cuts time spent in
SetRenderFramebuffer() from 1% to 0.13% (although a bit more time in
ExecuteOp, not much.)
This commit is contained in:
Unknown W. Brackets 2013-04-21 15:08:47 -07:00
parent b84dadfd3a
commit 85a23dac63
3 changed files with 13 additions and 0 deletions

View File

@ -497,6 +497,8 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
case GE_CMD_FRAMEBUFPTR:
case GE_CMD_FRAMEBUFWIDTH:
case GE_CMD_FRAMEBUFPIXFORMAT:
if (diff)
gstate_c.framebufChanged = true;
break;
case GE_CMD_TEXADDR0:
@ -693,6 +695,10 @@ void GLES_GPU::ExecuteOp(u32 op, u32 diff) {
case GE_CMD_VIEWPORTX1:
case GE_CMD_VIEWPORTY1:
if (diff)
gstate_c.framebufChanged = true;
break;
case GE_CMD_VIEWPORTX2:
case GE_CMD_VIEWPORTY2:
case GE_CMD_VIEWPORTZ1:

View File

@ -290,6 +290,12 @@ void GuessDrawingSize(int &drawing_width, int &drawing_height) {
}
void FramebufferManager::SetRenderFrameBuffer() {
if (!gstate_c.framebufChanged && currentRenderVfb_) {
currentRenderVfb_->last_frame_used = gpuStats.numFrames;
return;
}
gstate_c.framebufChanged = false;
// Get parameters
u32 fb_address = (gstate.fbptr & 0xFFE000) | ((gstate.fbwidth & 0xFF0000) << 8);
int fb_stride = gstate.fbwidth & 0x3C0;

View File

@ -252,6 +252,7 @@ struct GPUStateCache
u32 offsetAddr;
bool textureChanged;
bool framebufChanged;
int skipDrawReason;