1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-07-04 10:03:36 +00:00

Optimize FrameBuffer_SaveBuffer code.

This commit is contained in:
Sergey Lipskiy 2013-06-04 23:05:09 +07:00
parent 880238250b
commit 58728b954c

View File

@ -172,37 +172,18 @@ void FrameBuffer_SaveBuffer( u32 address, u16 size, u16 width, u16 height )
(current->scaleY != OGL.scaleY))
{
FrameBuffer_Remove( current );
current = NULL;
break;
}
ogl_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, current->fbo);
if (depthBuffer.top != NULL && depthBuffer.top->renderbuf > 0) {
ogl_glBindRenderbuffer(GL_RENDERBUFFER, depthBuffer.top->renderbuf);
ogl_glFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, depthBuffer.top->renderbuf);
}
// define the index array for the outputs
GLuint attachments[2] = { GL_COLOR_ATTACHMENT0, GL_DEPTH_ATTACHMENT };
ogl_glDrawBuffers(2, attachments, current->texture->glName);
assert(checkFBO());
#ifdef DEBUG
DebugMsg( DEBUG_HIGH | DEBUG_HANDLED, "FrameBuffer_SaveBuffer( 0x%08X ); \n", address);
#endif
*(u32*)&RDRAM[current->startAddress] = current->startAddress;
current->changed = TRUE;
FrameBuffer_MoveToTop( current );
gSP.changed |= CHANGED_TEXTURE;
return;
ogl_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, current->fbo);
break;
}
current = current->lower;
}
if (current == NULL) {
// Wasn't found, create a new one
current = FrameBuffer_AddTop();
@ -239,6 +220,7 @@ void FrameBuffer_SaveBuffer( u32 address, u16 size, u16 width, u16 height )
ogl_glGenFramebuffers(1, &current->fbo);
ogl_glBindFramebuffer(GL_DRAW_FRAMEBUFFER, current->fbo);
ogl_glFramebufferTexture(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, current->texture->glName, 0);
}
if (depthBuffer.top != NULL && depthBuffer.top->renderbuf > 0) {
ogl_glBindRenderbuffer(GL_RENDERBUFFER, depthBuffer.top->renderbuf);