[Mesa-dev] [PATCH 06/11] i965/meta: Return struct gl_renderbuffer* from brw_get_rb_for_slice instead of GL API handle

Ian Romanick idr at freedesktop.org
Fri Feb 5 21:04:18 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_context.h           |  7 ++++---
 src/mesa/drivers/dri/i965/brw_meta_fast_clear.c   |  9 +++++----
 src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c | 18 ++++++++++--------
 src/mesa/drivers/dri/i965/brw_meta_updownsample.c | 20 +++++++++++---------
 4 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_context.h b/src/mesa/drivers/dri/i965/brw_context.h
index 55d6723..1bcd7b0 100644
--- a/src/mesa/drivers/dri/i965/brw_context.h
+++ b/src/mesa/drivers/dri/i965/brw_context.h
@@ -1368,9 +1368,10 @@ GLboolean brwCreateContext(gl_api api,
 /*======================================================================
  * brw_misc_state.c
  */
-GLuint brw_get_rb_for_slice(struct brw_context *brw,
-                            struct intel_mipmap_tree *mt,
-                            unsigned level, unsigned layer, bool flat);
+struct gl_renderbuffer *brw_get_rb_for_slice(struct brw_context *brw,
+                                             struct intel_mipmap_tree *mt,
+                                             unsigned level, unsigned layer,
+                                             bool flat);
 
 void brw_meta_updownsample(struct brw_context *brw,
                            struct intel_mipmap_tree *src,
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 735d824..51dbd00 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
@@ -845,7 +845,8 @@ brw_meta_resolve_color(struct brw_context *brw,
                        struct intel_mipmap_tree *mt)
 {
    struct gl_context *ctx = &brw->ctx;
-   GLuint fbo, rbo;
+   GLuint fbo;
+   struct gl_renderbuffer *rb;
    struct rect rect;
 
    brw_emit_mi_flush(brw);
@@ -853,12 +854,12 @@ brw_meta_resolve_color(struct brw_context *brw,
    _mesa_meta_begin(ctx, MESA_META_ALL);
 
    _mesa_GenFramebuffers(1, &fbo);
-   rbo = brw_get_rb_for_slice(brw, mt, 0, 0, false);
+   rb = brw_get_rb_for_slice(brw, mt, 0, 0, false);
 
    _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, fbo);
    _mesa_FramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER,
                                  GL_COLOR_ATTACHMENT0,
-                                 GL_RENDERBUFFER, rbo);
+                                 GL_RENDERBUFFER, rb->Name);
    _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
 
    brw_fast_clear_init(brw);
@@ -881,7 +882,7 @@ brw_meta_resolve_color(struct brw_context *brw,
    set_fast_clear_op(brw, 0);
    use_rectlist(brw, false);
 
-   _mesa_DeleteRenderbuffers(1, &rbo);
+   _mesa_DeleteRenderbuffers(1, &rb->Name);
    _mesa_DeleteFramebuffers(1, &fbo);
 
    _mesa_meta_end(ctx);
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 c5f6c4f..4f3f7db 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
@@ -423,7 +423,8 @@ brw_meta_stencil_blit(struct brw_context *brw,
    struct gl_context *ctx = &brw->ctx;
    struct blit_dims dims = *orig_dims;
    struct fb_tex_blit_state blit;
-   GLuint prog, fbo, rbo;
+   GLuint prog, fbo;
+   struct gl_renderbuffer *rb;
    GLenum target;
 
    _mesa_meta_fb_tex_blit_begin(ctx, &blit);
@@ -436,13 +437,13 @@ brw_meta_stencil_blit(struct brw_context *brw,
 
    _mesa_GenFramebuffers(1, &fbo);
    /* Force the surface to be configured for level zero. */
-   rbo = brw_get_rb_for_slice(brw, dst_mt, 0, dst_layer, true);
+   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_FramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
-                                 GL_RENDERBUFFER, rbo);
+                                 GL_RENDERBUFFER, rb->Name);
    _mesa_DrawBuffer(GL_COLOR_ATTACHMENT0);
    ctx->DrawBuffer->_Status = GL_FRAMEBUFFER_COMPLETE;
 
@@ -474,7 +475,7 @@ error:
    _mesa_meta_fb_tex_blit_end(ctx, target, &blit);
    _mesa_meta_end(ctx);
 
-   _mesa_DeleteRenderbuffers(1, &rbo);
+   _mesa_DeleteRenderbuffers(1, &rb->Name);
    _mesa_DeleteFramebuffers(1, &fbo);
 }
 
@@ -532,7 +533,8 @@ brw_meta_stencil_updownsample(struct brw_context *brw,
       .dst_x0 = 0, .dst_y0 = 0,
       .dst_x1 = dst->logical_width0, .dst_y1 = dst->logical_height0,
       .mirror_x = 0, .mirror_y = 0 };
-   GLuint fbo, rbo;
+   GLuint fbo;
+   struct gl_renderbuffer *rb;
 
    if (dst->stencil_mt)
       dst = dst->stencil_mt;
@@ -541,15 +543,15 @@ brw_meta_stencil_updownsample(struct brw_context *brw,
    _mesa_meta_begin(ctx, MESA_META_ALL);
 
    _mesa_GenFramebuffers(1, &fbo);
-   rbo = brw_get_rb_for_slice(brw, src, 0, 0, false);
+   rb = brw_get_rb_for_slice(brw, src, 0, 0, false);
 
    _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
    _mesa_FramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_STENCIL_ATTACHMENT,
-                                 GL_RENDERBUFFER, rbo);
+                                 GL_RENDERBUFFER, rb->Name);
 
    brw_meta_stencil_blit(brw, dst, 0, 0, &dims);
    brw_emit_mi_flush(brw);
 
-   _mesa_DeleteRenderbuffers(1, &rbo);
+   _mesa_DeleteRenderbuffers(1, &rb->Name);
    _mesa_DeleteFramebuffers(1, &fbo);
 }
diff --git a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
index 563160e..c1631ae 100644
--- a/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
+++ b/src/mesa/drivers/dri/i965/brw_meta_updownsample.c
@@ -45,7 +45,7 @@
  *
  * Clobbers the current renderbuffer binding (ctx->CurrentRenderbuffer).
  */
-GLuint
+struct gl_renderbuffer *
 brw_get_rb_for_slice(struct brw_context *brw,
                      struct intel_mipmap_tree *mt,
                      unsigned level, unsigned layer, bool flat)
@@ -88,7 +88,7 @@ brw_get_rb_for_slice(struct brw_context *brw,
 
    intel_miptree_reference(&irb->mt, mt);
 
-   return rbo;
+   return rb;
 }
 
 /**
@@ -100,7 +100,9 @@ brw_meta_updownsample(struct brw_context *brw,
                       struct intel_mipmap_tree *dst_mt)
 {
    struct gl_context *ctx = &brw->ctx;
-   GLuint fbos[2], src_rbo, dst_rbo, src_fbo, dst_fbo;
+   GLuint fbos[2], src_fbo, dst_fbo;
+   struct gl_renderbuffer *src_rb;
+   struct gl_renderbuffer *dst_rb;
    GLenum drawbuffer;
    GLbitfield attachment, blit_bit;
 
@@ -119,19 +121,19 @@ brw_meta_updownsample(struct brw_context *brw,
 
    _mesa_meta_begin(ctx, MESA_META_ALL);
    _mesa_GenFramebuffers(2, fbos);
-   src_rbo = brw_get_rb_for_slice(brw, src_mt, 0, 0, false);
-   dst_rbo = brw_get_rb_for_slice(brw, dst_mt, 0, 0, false);
+   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];
 
    _mesa_BindFramebuffer(GL_READ_FRAMEBUFFER, src_fbo);
    _mesa_FramebufferRenderbuffer(GL_READ_FRAMEBUFFER, attachment,
-                                 GL_RENDERBUFFER, src_rbo);
+                                 GL_RENDERBUFFER, src_rb->Name);
    _mesa_ReadBuffer(drawbuffer);
 
    _mesa_BindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_fbo);
    _mesa_FramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, attachment,
-                                 GL_RENDERBUFFER, dst_rbo);
+                                 GL_RENDERBUFFER, dst_rb->Name);
    _mesa_DrawBuffer(drawbuffer);
 
    _mesa_BlitFramebuffer(0, 0,
@@ -140,8 +142,8 @@ brw_meta_updownsample(struct brw_context *brw,
                          dst_mt->logical_width0, dst_mt->logical_height0,
                          blit_bit, GL_NEAREST);
 
-   _mesa_DeleteRenderbuffers(1, &src_rbo);
-   _mesa_DeleteRenderbuffers(1, &dst_rbo);
+   _mesa_DeleteRenderbuffers(1, &src_rb->Name);
+   _mesa_DeleteRenderbuffers(1, &dst_rb->Name);
    _mesa_DeleteFramebuffers(2, fbos);
 
    _mesa_meta_end(ctx);
-- 
2.5.0



More information about the mesa-dev mailing list