mesa: Rename "struct gl_array_object" to gl_vertex_array_object.
[mesa.git] / src / mesa / main / renderbuffer.c
index 1bb09bfe6a18ff413aa21fef0f8fa7f10f0c721f..2ff96e548ebcd595dce9db13db6acfe6c4759a13 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * Mesa 3-D graphics library
- * Version:  6.5
  *
  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
  *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
  */
 
 
@@ -52,6 +52,7 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
 
    rb->Width = 0;
    rb->Height = 0;
+   rb->Depth = 0;
    rb->InternalFormat = GL_RGBA;
    rb->Format = MESA_FORMAT_NONE;
 }
@@ -75,11 +76,16 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
 /**
  * Delete a gl_framebuffer.
  * This is the default function for renderbuffer->Delete().
+ * Drivers which subclass gl_renderbuffer should probably implement their
+ * own delete function.  But the driver might also call this function to
+ * free the object in the end.
  */
 void
-_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
+_mesa_delete_renderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
 {
-   /* no-op */
+   _glthread_DESTROY_MUTEX(rb->Mutex);
+   free(rb->Label);
+   free(rb);
 }
 
 
@@ -155,7 +161,8 @@ _mesa_reference_renderbuffer_(struct gl_renderbuffer **ptr,
       _glthread_UNLOCK_MUTEX(oldRb->Mutex);
 
       if (deleteFlag) {
-         oldRb->Delete(oldRb);
+         GET_CURRENT_CONTEXT(ctx);
+         oldRb->Delete(ctx, oldRb);
       }
 
       *ptr = NULL;