mesa: tidy up renderbuffer RefCount initialisation
authorTimothy Arceri <tarceri@itsqueeze.com>
Wed, 5 Apr 2017 10:03:47 +0000 (20:03 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Wed, 5 Apr 2017 22:17:10 +0000 (08:17 +1000)
42aaa548 changed the renderbuffer initialisation of RefCount from
1 to 0.

This is inconsitent with how we use RefCount elsewhere. Also every
driver implementation of NewRenderbuffer() calls
_mesa_init_renderbuffer() so its safe to set it there.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/drivers/common/meta.c
src/mesa/main/fbobject.c
src/mesa/main/renderbuffer.c

index efbc93402e16b403ab2fab8fd85077b40b9d5901..f4c91ac22cce973aeb1f4a5b7e85ae1d1e8ed3ad 100644 (file)
@@ -3044,8 +3044,6 @@ decompress_texture_image(struct gl_context *ctx,
          return false;
       }
 
-      decompress_fbo->rb->RefCount = 1;
-
       decompress_fbo->fb = ctx->Driver.NewFramebuffer(ctx, 0xDEADBEEF);
       if (decompress_fbo->fb == NULL) {
          _mesa_meta_end(ctx);
index f73a009d626d99a9fc55e94eca488dde297793e0..5048327e5ed3c1f7c058e89b80bfb00794cf8448 100644 (file)
@@ -1323,7 +1323,6 @@ allocate_renderbuffer_locked(struct gl_context *ctx, GLuint renderbuffer,
    }
    assert(newRb->AllocStorage);
    _mesa_HashInsertLocked(ctx->Shared->RenderBuffers, renderbuffer, newRb);
-   newRb->RefCount = 1; /* referenced by hash table */
 
    return newRb;
 }
index b0d4c8cca264f8c2967946564af369b2fd9851c9..4375b5b882caa8ce6551485fd0fb692f55d3de82 100644 (file)
@@ -44,7 +44,7 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
 
    rb->ClassID = 0;
    rb->Name = name;
-   rb->RefCount = 0;
+   rb->RefCount = 1;
    rb->Delete = _mesa_delete_renderbuffer;
 
    /* The rest of these should be set later by the caller of this function or