mesa: fix typo and add assert() to _mesa_attach_renderbuffer_without_ref()
authorTimothy Arceri <tarceri@itsqueeze.com>
Mon, 10 Apr 2017 23:57:45 +0000 (09:57 +1000)
committerTimothy Arceri <tarceri@itsqueeze.com>
Mon, 10 Apr 2017 23:57:45 +0000 (09:57 +1000)
This function should only be used with a "freshly created" renderbuffer
so assert RefCount is 1.

src/mesa/main/renderbuffer.c

index 627bdca66c5726df03ce006864dc10ca33b3c007..b58b3f3e91398a4baf0f86f55cf7f5b1e1e1be53 100644 (file)
@@ -141,13 +141,15 @@ validate_and_init_renderbuffer_attachment(struct gl_framebuffer *fb,
  * \param bufferName  one of the BUFFER_x tokens
  *
  * This function avoids adding a reference and is therefore intended to be
- * used with a freashly created renderbuffer.
+ * used with a freshly created renderbuffer.
  */
 void
 _mesa_add_renderbuffer_without_ref(struct gl_framebuffer *fb,
                                    gl_buffer_index bufferName,
                                    struct gl_renderbuffer *rb)
 {
+   assert(rb->RefCount == 1);
+
    validate_and_init_renderbuffer_attachment(fb, bufferName, rb);
 
    _mesa_reference_renderbuffer(&fb->Attachment[bufferName].Renderbuffer,