void FBO_FastBlit(FBO_t *src, ivec4_t srcBox, FBO_t *dst, ivec4_t dstBox, int buffers, int filter) { ivec4_t srcBoxFinal, dstBoxFinal; GLuint srcFb, dstFb; if (!glRefConfig.framebufferBlit) { FBO_Blit(src, srcBox, NULL, dst, dstBox, NULL, NULL, 0); return; } srcFb = src ? src->frameBuffer : 0; dstFb = dst ? dst->frameBuffer : 0; if (!srcBox) { int width = src ? src->width : glConfig.vidWidth; int height = src ? src->height : glConfig.vidHeight; VectorSet4(srcBoxFinal, 0, 0, width, height); } else { VectorSet4(srcBoxFinal, srcBox[0], srcBox[1], srcBox[0] + srcBox[2], srcBox[1] + srcBox[3]); } if (!dstBox) { int width = dst ? dst->width : glConfig.vidWidth; int height = dst ? dst->height : glConfig.vidHeight; VectorSet4(dstBoxFinal, 0, 0, width, height); } else { VectorSet4(dstBoxFinal, dstBox[0], dstBox[1], dstBox[0] + dstBox[2], dstBox[1] + dstBox[3]); } GL_BindFramebuffer(GL_READ_FRAMEBUFFER, srcFb); GL_BindFramebuffer(GL_DRAW_FRAMEBUFFER, dstFb); qglBlitFramebuffer(srcBoxFinal[0], srcBoxFinal[1], srcBoxFinal[2], srcBoxFinal[3], dstBoxFinal[0], dstBoxFinal[1], dstBoxFinal[2], dstBoxFinal[3], buffers, filter); GL_BindFramebuffer(GL_FRAMEBUFFER, 0); glState.currentFBO = NULL; }
/** * @brief Forces multisample antialiasing resolve on given framebuffer, if needed * @param[in] buf the framebuffer to use */ void R_ResolveMSAA (const r_framebuffer_t *buf) { int i; if (!buf->samples) return; qglBindFramebufferEXT(GL_READ_FRAMEBUFFER_EXT,buf->fbo); qglBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT,buf->proxyFBO); for (i = 0; i < buf->nTextures; i++) { glReadBuffer(GL_COLOR_ATTACHMENT0_EXT + i); glDrawBuffer(GL_COLOR_ATTACHMENT0_EXT + i); qglBlitFramebuffer(0, 0, buf->width, buf-> height, 0, 0, buf->width, buf->height, GL_COLOR_BUFFER_BIT, GL_NEAREST); R_CheckError(); } R_CheckError(); qglBindFramebufferEXT(GL_FRAMEBUFFER_EXT, screenBuffer.fbo); R_CheckError(); }