i965/meta: Return struct gl_renderbuffer* from brw_get_rb_for_slice instead of GL...
authorIan Romanick <ian.d.romanick@intel.com>
Wed, 11 Nov 2015 23:57:25 +0000 (15:57 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 10 Feb 2016 18:59:42 +0000 (10:59 -0800)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Anuj Phogat <anuj.phogat@gmail.com>
src/mesa/drivers/dri/i965/brw_context.h
src/mesa/drivers/dri/i965/brw_meta_fast_clear.c
src/mesa/drivers/dri/i965/brw_meta_stencil_blit.c
src/mesa/drivers/dri/i965/brw_meta_updownsample.c

index 5c63b8f36c66b4c41aa73b3fdfa2ab6e841b5a5a..6b82bea52c02173ebd8cde84b693f3ebf0e1a58b 100644 (file)
@@ -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,
index 735d82495d8cbd37da1b5732d47f1e7f644a9ea0..51dbd000b1dd53e977dde9f7cc9d5a7f54a36adb 100644 (file)
@@ -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);
index c5f6c4f8fc88b7f2a82a48c3f1bd602358bd0b5f..4f3f7dbc78cf505f3cd82799c1e0ab7bb4d7b261 100644 (file)
@@ -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);
 }
index 563160e599b5e39ac2956700ac49b080565c69e8..c1631aeb0b55a4f40d76eb871226bae5711279ea 100644 (file)
@@ -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);