[Mesa-dev] [PATCH 12/13] i965/meta: Use _mesa_bind_framebuffers instead of _mesa_BindFramebuffer

Ian Romanick idr at freedesktop.org
Thu Feb 11 06:13:22 UTC 2016


From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/mesa/drivers/dri/i965/brw_meta_fast_clear.c   |  7 ++++++-
 src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c | 12 ++++++++++--
 src/mesa/drivers/dri/i965/brw_meta_updownsample.c | 14 +++++++++-----
 3 files changed, 25 insertions(+), 8 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
index 42ee763..89ec0d5 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
@@ -847,6 +847,7 @@ brw_meta_resolve_color(struct brw_context *brw,
 {
    struct gl_context *ctx = &brw->ctx;
    GLuint fbo;
+   struct gl_framebuffer *drawFb;
    struct gl_renderbuffer *rb;
    struct rect rect;
 
@@ -855,9 +856,13 @@ brw_meta_resolve_color(struct brw_context *brw,
    _mesa_meta_begin(ctx, MESA_META_ALL);
 
    _mesa_CreateFramebuffers(1, &fbo);
+
+   drawFb = _mesa_lookup_framebuffer(ctx, fbo);
+   assert(drawFb != NULL && drawFb->Name == fbo);
+
    rb = brw_get_rb_for_slice(brw, mt, 0, 0, false);
 
-   _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
+   _mesa_bind_framebuffers(ctx, drawFb, ctx->ReadBuffer);
    _mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, GL_COLOR_ATTACHMENT0,
                                   rb);
    _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
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 ab8d677..d1a8780 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -425,6 +425,7 @@ brw_meta_stencil_blit(struct brw_context *brw,
    struct blit_dims dims = *orig_dims;
    struct fb_tex_blit_state blit;
    GLuint prog, fbo;
+   struct gl_framebuffer *drawFb;
    struct gl_renderbuffer *rb;
    GLenum target;
 
@@ -437,12 +438,15 @@ brw_meta_stencil_blit(struct brw_context *brw,
    ctx->Extensions.ARB_texture_stencil8 = true;
 
    _mesa_CreateFramebuffers(1, &fbo);
+   drawFb = _mesa_lookup_framebuffer(ctx, fbo);
+   assert(drawFb != NULL && drawFb->Name == fbo);
+
    /* Force the surface to be configured for level zero. */
    rb = brw_get_rb_for_slice(brw, dst_mt, 0, dst_layer, true);
    adjust_msaa(&dims, dst_mt->num_samples);
    adjust_tiling(&dims, dst_mt->num_samples);
 
-   _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
+   _mesa_bind_framebuffers(ctx, drawFb, ctx->ReadBuffer);
    _mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, GL_COLOR_ATTACHMENT0,
                                   rb);
    _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
@@ -535,6 +539,7 @@ brw_meta_stencil_updownsample(struct brw_context *brw,
       .dst_x1 = dst->logical_width0, .dst_y1 = dst->logical_height0,
       .mirror_x = 0, .mirror_y = 0 };
    GLuint fbo;
+   struct gl_framebuffer *readFb;
    struct gl_renderbuffer *rb;
 
    if (dst->stencil_mt)
@@ -544,9 +549,12 @@ brw_meta_stencil_updownsample(struct brw_context *brw,
    _mesa_meta_begin(ctx, MESA_META_ALL);
 
    _mesa_CreateFramebuffers(1, &fbo);
+   readFb = _mesa_lookup_framebuffer(ctx, fbo);
+   assert(readFb != NULL && readFb->Name == fbo);
+
    rb = brw_get_rb_for_slice(brw, src, 0, 0, false);
 
-   _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
+   _mesa_bind_framebuffers(ctx, ctx->DrawBuffer, readFb);
    _mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, GL_STENCIL_ATTACHMENT,
                                   rb);
 
diff --git a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
index 213de2a..da06fef 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
@@ -93,7 +93,9 @@ brw_meta_updownsample(struct brw_context *brw,
                       struct intel_mipmap_tree *dst_mt)
 {
    struct gl_context *ctx = &brw->ctx;
-   GLuint fbos[2], src_fbo, dst_fbo;
+   GLuint fbos[2];
+   struct gl_framebuffer *src_fb;
+   struct gl_framebuffer *dst_fb;
    struct gl_renderbuffer *src_rb;
    struct gl_renderbuffer *dst_rb;
    GLenum drawbuffer;
@@ -116,14 +118,16 @@ brw_meta_updownsample(struct brw_context *brw,
    _mesa_CreateFramebuffers(2, fbos);
    src_rb = brw_get_rb_for_slice(brw, src_mt, 0, 0, false);
    dst_rb = brw_get_rb_for_slice(brw, dst_mt, 0, 0, false);
-   src_fbo = fbos[0];
-   dst_fbo = fbos[1];
+   src_fb = _mesa_lookup_framebuffer(ctx, fbos[0]);
+   dst_fb = _mesa_lookup_framebuffer(ctx, fbos[1]);
 
-   _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo);
+   assert(src_fb != NULL && src_fb->Name == fbos[0]);
+   assert(dst_fb != NULL && dst_fb->Name == fbos[1]);
+
+   _mesa_bind_framebuffers(ctx, dst_fb, src_fb);
    _mesa_framebuffer_renderbuffer(ctx, ctx->ReadBuffer, attachment, src_rb);
    _mesa_ReadBuffer(drawbuffer);
 
-   _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo);
    _mesa_framebuffer_renderbuffer(ctx, ctx->DrawBuffer, attachment, dst_rb);
    _mesa_DrawBuffer(drawbuffer);
 
-- 
2.5.0



More information about the mesa-dev mailing list