summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorLaura Ekstrand <[email protected]>2015-01-30 14:03:53 -0800
committerLaura Ekstrand <[email protected]>2015-02-02 13:21:20 -0800
commite187c2f5432466c7b49dba266026fb9b01f5f667 (patch)
tree6232bca416174ed9c15bdbc69b8c6e650cad76c8 /src/mesa/drivers/dri
parentad2c64abbd7326be35fa1f94c7e056e868ee6185 (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/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/i915/intel_fbo.c14
-rw-r--r--src/mesa/drivers/dri/i965/brw_blorp_blit.cpp15
-rw-r--r--src/mesa/drivers/dri/i965/brw_context.h4
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c10
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_util.c5
-rw-r--r--src/mesa/drivers/dri/i965/brw_meta_util.h2
-rw-r--r--src/mesa/drivers/dri/i965/intel_fbo.c20
7 files changed, 41 insertions, 29 deletions
diff --git a/src/mesa/drivers/dri/i915/intel_fbo.c b/src/mesa/drivers/dri/i915/intel_fbo.c
index e138b854e33..ead1b17b69d 100644
--- a/src/mesa/drivers/dri/i915/intel_fbo.c
+++ b/src/mesa/drivers/dri/i915/intel_fbo.c
@@ -649,6 +649,8 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
*/
static GLbitfield
intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
+ const struct gl_framebuffer *readFb,
+ const struct gl_framebuffer *drawFb,
GLint srcX0, GLint srcY0,
GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0,
@@ -659,8 +661,6 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
if (mask & GL_COLOR_BUFFER_BIT) {
GLint i;
- const struct gl_framebuffer *drawFb = ctx->DrawBuffer;
- const struct gl_framebuffer *readFb = ctx->ReadBuffer;
struct gl_renderbuffer *src_rb = readFb->_ColorReadBuffer;
struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
@@ -696,8 +696,8 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
* results are undefined if any destination pixels have a dependency on
* source pixels.
*/
- for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
- struct gl_renderbuffer *dst_rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
+ for (i = 0; i < drawFb->_NumColorDrawBuffers; i++) {
+ struct gl_renderbuffer *dst_rb = drawFb->_ColorDrawBuffers[i];
struct intel_renderbuffer *dst_irb = intel_renderbuffer(dst_rb);
if (!dst_irb) {
@@ -738,12 +738,14 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
static void
intel_blit_framebuffer(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)
{
/* Try using the BLT engine. */
- mask = intel_blit_framebuffer_with_blitter(ctx,
+ mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask, filter);
@@ -751,7 +753,7 @@ intel_blit_framebuffer(struct gl_context *ctx,
return;
- _mesa_meta_and_swrast_BlitFramebuffer(ctx,
+ _mesa_meta_and_swrast_BlitFramebuffer(ctx, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask, filter);
diff --git a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
index 936feafdae4..10a53dc0ac4 100644
--- a/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
+++ b/src/mesa/drivers/dri/i965/brw_blorp_blit.cpp
@@ -125,6 +125,8 @@ do_blorp_blit(struct brw_context *brw, GLbitfield buffer_bit,
static bool
try_blorp_blit(struct brw_context *brw,
+ const struct gl_framebuffer *read_fb,
+ const struct gl_framebuffer *draw_fb,
GLfloat srcX0, GLfloat srcY0, GLfloat srcX1, GLfloat srcY1,
GLfloat dstX0, GLfloat dstY0, GLfloat dstX1, GLfloat dstY1,
GLenum filter, GLbitfield buffer_bit)
@@ -136,11 +138,8 @@ try_blorp_blit(struct brw_context *brw,
*/
intel_prepare_render(brw);
- const struct gl_framebuffer *read_fb = ctx->ReadBuffer;
- const struct gl_framebuffer *draw_fb = ctx->DrawBuffer;
-
bool mirror_x, mirror_y;
- if (brw_meta_mirror_clip_and_scissor(ctx,
+ if (brw_meta_mirror_clip_and_scissor(ctx, read_fb, draw_fb,
&srcX0, &srcY0, &srcX1, &srcY1,
&dstX0, &dstY0, &dstX1, &dstY1,
&mirror_x, &mirror_y))
@@ -154,8 +153,8 @@ try_blorp_blit(struct brw_context *brw,
switch (buffer_bit) {
case GL_COLOR_BUFFER_BIT:
src_irb = intel_renderbuffer(read_fb->_ColorReadBuffer);
- for (unsigned i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; ++i) {
- dst_irb = intel_renderbuffer(ctx->DrawBuffer->_ColorDrawBuffers[i]);
+ for (unsigned i = 0; i < draw_fb->_NumColorDrawBuffers; ++i) {
+ dst_irb = intel_renderbuffer(draw_fb->_ColorDrawBuffers[i]);
if (dst_irb)
do_blorp_blit(brw, buffer_bit,
src_irb, src_irb->Base.Base.Format,
@@ -317,6 +316,8 @@ brw_blorp_copytexsubimage(struct brw_context *brw,
GLbitfield
brw_blorp_framebuffer(struct brw_context *brw,
+ 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)
@@ -333,7 +334,7 @@ brw_blorp_framebuffer(struct brw_context *brw,
for (unsigned int i = 0; i < ARRAY_SIZE(buffer_bits); ++i) {
if ((mask & buffer_bits[i]) &&
- try_blorp_blit(brw,
+ try_blorp_blit(brw, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
filter, buffer_bits[i])) {
diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 6195d3d8158..d315793b0b5 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1489,6 +1489,8 @@ void brw_meta_updownsample(struct brw_context *brw,
struct intel_mipmap_tree *dst);
void brw_meta_fbo_stencil_blit(struct brw_context *brw,
+ struct gl_framebuffer *read_fb,
+ struct gl_framebuffer *draw_fb,
GLfloat srcX0, GLfloat srcY0,
GLfloat srcX1, GLfloat srcY1,
GLfloat dstX0, GLfloat dstY0,
@@ -1713,6 +1715,8 @@ gen7_resume_transform_feedback(struct gl_context *ctx,
/* brw_blorp_blit.cpp */
GLbitfield
brw_blorp_framebuffer(struct brw_context *brw,
+ 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);
diff --git a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
index b9b481b90eb..fc7018d15b9 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -460,15 +460,17 @@ error:
void
brw_meta_fbo_stencil_blit(struct brw_context *brw,
+ struct gl_framebuffer *read_fb,
+ struct gl_framebuffer *draw_fb,
GLfloat src_x0, GLfloat src_y0,
GLfloat src_x1, GLfloat src_y1,
GLfloat dst_x0, GLfloat dst_y0,
GLfloat dst_x1, GLfloat dst_y1)
{
struct gl_context *ctx = &brw->ctx;
- struct gl_renderbuffer *draw_fb =
- ctx->DrawBuffer->Attachment[BUFFER_STENCIL].Renderbuffer;
- const struct intel_renderbuffer *dst_irb = intel_renderbuffer(draw_fb);
+ struct gl_renderbuffer *draw_rb =
+ draw_fb->Attachment[BUFFER_STENCIL].Renderbuffer;
+ const struct intel_renderbuffer *dst_irb = intel_renderbuffer(draw_rb);
struct intel_mipmap_tree *dst_mt = dst_irb->mt;
if (!dst_mt)
@@ -478,7 +480,7 @@ brw_meta_fbo_stencil_blit(struct brw_context *brw,
dst_mt = dst_mt->stencil_mt;
bool mirror_x, mirror_y;
- if (brw_meta_mirror_clip_and_scissor(ctx,
+ if (brw_meta_mirror_clip_and_scissor(ctx, read_fb, draw_fb,
&src_x0, &src_y0, &src_x1, &src_y1,
&dst_x0, &dst_y0, &dst_x1, &dst_y1,
&mirror_x, &mirror_y))
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.c b/src/mesa/drivers/dri/i965/brw_meta_util.c
index 72ed96ce692..a3b060413e5 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.c
@@ -104,15 +104,14 @@ clip_or_scissor(bool mirror,
bool
brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
+ const struct gl_framebuffer *read_fb,
+ const struct gl_framebuffer *draw_fb,
GLfloat *srcX0, GLfloat *srcY0,
GLfloat *srcX1, GLfloat *srcY1,
GLfloat *dstX0, GLfloat *dstY0,
GLfloat *dstX1, GLfloat *dstY1,
bool *mirror_x, bool *mirror_y)
{
- const struct gl_framebuffer *read_fb = ctx->ReadBuffer;
- const struct gl_framebuffer *draw_fb = ctx->DrawBuffer;
-
*mirror_x = false;
*mirror_y = false;
diff --git a/src/mesa/drivers/dri/i965/brw_meta_util.h b/src/mesa/drivers/dri/i965/brw_meta_util.h
index ccd8642010c..dc9dff2bce3 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_util.h
+++ b/src/mesa/drivers/dri/i965/brw_meta_util.h
@@ -33,6 +33,8 @@ extern "C" {
bool
brw_meta_mirror_clip_and_scissor(const struct gl_context *ctx,
+ const struct gl_framebuffer *read_fb,
+ const struct gl_framebuffer *draw_fb,
GLfloat *srcX0, GLfloat *srcY0,
GLfloat *srcX1, GLfloat *srcY1,
GLfloat *dstX0, GLfloat *dstY0,
diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c
index 7bdf99548f6..3ee1a55b8c7 100644
--- a/src/mesa/drivers/dri/i965/intel_fbo.c
+++ b/src/mesa/drivers/dri/i965/intel_fbo.c
@@ -779,6 +779,8 @@ intel_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
*/
static GLbitfield
intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
+ const struct gl_framebuffer *readFb,
+ const struct gl_framebuffer *drawFb,
GLint srcX0, GLint srcY0,
GLint srcX1, GLint srcY1,
GLint dstX0, GLint dstY0,
@@ -794,8 +796,6 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
if (mask & GL_COLOR_BUFFER_BIT) {
GLint i;
- const struct gl_framebuffer *drawFb = ctx->DrawBuffer;
- const struct gl_framebuffer *readFb = ctx->ReadBuffer;
struct gl_renderbuffer *src_rb = readFb->_ColorReadBuffer;
struct intel_renderbuffer *src_irb = intel_renderbuffer(src_rb);
@@ -831,8 +831,8 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
* results are undefined if any destination pixels have a dependency on
* source pixels.
*/
- for (i = 0; i < ctx->DrawBuffer->_NumColorDrawBuffers; i++) {
- struct gl_renderbuffer *dst_rb = ctx->DrawBuffer->_ColorDrawBuffers[i];
+ for (i = 0; i < drawFb->_NumColorDrawBuffers; i++) {
+ struct gl_renderbuffer *dst_rb = drawFb->_ColorDrawBuffers[i];
struct intel_renderbuffer *dst_irb = intel_renderbuffer(dst_rb);
if (!dst_irb) {
@@ -863,6 +863,8 @@ intel_blit_framebuffer_with_blitter(struct gl_context *ctx,
static void
intel_blit_framebuffer(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)
@@ -876,7 +878,7 @@ intel_blit_framebuffer(struct gl_context *ctx,
if (!_mesa_check_conditional_render(ctx))
return;
- mask = brw_blorp_framebuffer(brw,
+ mask = brw_blorp_framebuffer(brw, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask, filter);
@@ -884,7 +886,7 @@ intel_blit_framebuffer(struct gl_context *ctx,
return;
if (brw->gen >= 8 && (mask & GL_STENCIL_BUFFER_BIT)) {
- brw_meta_fbo_stencil_blit(brw_context(ctx),
+ brw_meta_fbo_stencil_blit(brw_context(ctx), readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1);
mask &= ~GL_STENCIL_BUFFER_BIT;
@@ -893,21 +895,21 @@ intel_blit_framebuffer(struct gl_context *ctx,
}
/* Try using the BLT engine. */
- mask = intel_blit_framebuffer_with_blitter(ctx,
+ mask = intel_blit_framebuffer_with_blitter(ctx, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask, filter);
if (mask == 0x0)
return;
- mask = _mesa_meta_BlitFramebuffer(ctx,
+ mask = _mesa_meta_BlitFramebuffer(ctx, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask, filter);
if (mask == 0x0)
return;
- _swrast_BlitFramebuffer(ctx,
+ _swrast_BlitFramebuffer(ctx, readFb, drawFb,
srcX0, srcY0, srcX1, srcY1,
dstX0, dstY0, dstX1, dstY1,
mask, filter);