diff options
author | Laura Ekstrand <[email protected]> | 2015-01-30 14:03:53 -0800 |
---|---|---|
committer | Laura Ekstrand <[email protected]> | 2015-02-02 13:21:20 -0800 |
commit | e187c2f5432466c7b49dba266026fb9b01f5f667 (patch) | |
tree | 6232bca416174ed9c15bdbc69b8c6e650cad76c8 /src/mesa/swrast/s_blit.c | |
parent | ad2c64abbd7326be35fa1f94c7e056e868ee6185 (diff) |
DD: Refactor BlitFramebuffer.
In preparation for glBlitNamedFramebuffer, the DD table function
BlitFramebuffer needs to accept two arbitrary framebuffer objects rather
than assuming ctx->ReadBuffer and ctx->DrawBuffer.
Reviewed-by: Jason Ekstrand <[email protected]>
Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/swrast/s_blit.c')
-rw-r--r-- | src/mesa/swrast/s_blit.c | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/mesa/swrast/s_blit.c b/src/mesa/swrast/s_blit.c index e3b45f14682..48936d32917 100644 --- a/src/mesa/swrast/s_blit.c +++ b/src/mesa/swrast/s_blit.c @@ -107,14 +107,14 @@ RESAMPLE(resample_row_16, GLuint, 4) */ static void blit_nearest(struct gl_context *ctx, + struct gl_framebuffer *readFb, + struct gl_framebuffer *drawFb, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield buffer) { struct gl_renderbuffer *readRb, *drawRb = NULL; struct gl_renderbuffer_attachment *readAtt = NULL, *drawAtt = NULL; - struct gl_framebuffer *readFb = ctx->ReadBuffer; - struct gl_framebuffer *drawFb = ctx->DrawBuffer; GLuint numDrawBuffers = 0; GLuint i; @@ -508,11 +508,11 @@ resample_linear_row_float(GLint srcWidth, GLint dstWidth, */ static void blit_linear(struct gl_context *ctx, + struct gl_framebuffer *readFb, + struct gl_framebuffer *drawFb, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1) { - struct gl_framebuffer *drawFb = ctx->DrawBuffer; - struct gl_framebuffer *readFb = ctx->ReadBuffer; struct gl_renderbuffer *readRb = readFb->_ColorReadBuffer; struct gl_renderbuffer_attachment *readAtt = &readFb->Attachment[readFb->_ColorReadBufferIndex]; @@ -733,6 +733,8 @@ fail_no_memory: */ void _swrast_BlitFramebuffer(struct gl_context *ctx, + struct gl_framebuffer *readFb, + struct gl_framebuffer *drawFb, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) @@ -756,7 +758,7 @@ _swrast_BlitFramebuffer(struct gl_context *ctx, if (!_mesa_check_conditional_render(ctx)) return; /* Do not blit */ - if (!_mesa_clip_blit(ctx, &srcX0, &srcY0, &srcX1, &srcY1, + if (!_mesa_clip_blit(ctx, readFb, drawFb, &srcX0, &srcY0, &srcX1, &srcY1, &dstX0, &dstY0, &dstX1, &dstY1)) { return; } @@ -775,14 +777,15 @@ _swrast_BlitFramebuffer(struct gl_context *ctx, dstY0 < dstY1) { for (i = 0; i < 3; i++) { if (mask & buffers[i]) { - if (swrast_fast_copy_pixels(ctx, - srcX0, srcY0, - srcX1 - srcX0, srcY1 - srcY0, - dstX0, dstY0, - buffer_enums[i])) { - mask &= ~buffers[i]; - } - } + if (swrast_fast_copy_pixels(ctx, + readFb, drawFb, + srcX0, srcY0, + srcX1 - srcX0, srcY1 - srcY0, + dstX0, dstY0, + buffer_enums[i])) { + mask &= ~buffers[i]; + } + } } if (!mask) @@ -791,17 +794,17 @@ _swrast_BlitFramebuffer(struct gl_context *ctx, if (filter == GL_NEAREST) { for (i = 0; i < 3; i++) { - if (mask & buffers[i]) { - blit_nearest(ctx, srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1, buffers[i]); - } + if (mask & buffers[i]) { + blit_nearest(ctx, readFb, drawFb, srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1, buffers[i]); + } } } else { ASSERT(filter == GL_LINEAR); if (mask & GL_COLOR_BUFFER_BIT) { /* depth/stencil not allowed */ - blit_linear(ctx, srcX0, srcY0, srcX1, srcY1, - dstX0, dstY0, dstX1, dstY1); + blit_linear(ctx, readFb, drawFb, srcX0, srcY0, srcX1, srcY1, + dstX0, dstY0, dstX1, dstY1); } } |