summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-01-16 12:15:40 -0700
committerBrian Paul <[email protected]>2012-01-24 14:12:25 -0700
commitf6a3979a0444a14c198c10501e9ff13f24625443 (patch)
tree395a4521839ba3fb839911eaa724998a5e32617d /src/mesa
parentf9874feef4d8952df5054bd8e8f4e0deda4ef44f (diff)
mesa: move freeing of software renderbuffers into swrast
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/main/renderbuffer.c7
-rw-r--r--src/mesa/swrast/s_renderbuffer.c15
2 files changed, 16 insertions, 6 deletions
diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 2f0b28934b6..4bc4165fb9e 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -55,8 +55,6 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
rb->InternalFormat = GL_RGBA;
rb->Format = MESA_FORMAT_NONE;
- rb->Data = NULL;
-
/* Point back to ourself so that we don't have to check for Wrapped==NULL
* all over the drivers.
*/
@@ -86,10 +84,7 @@ _mesa_new_renderbuffer(struct gl_context *ctx, GLuint name)
void
_mesa_delete_renderbuffer(struct gl_renderbuffer *rb)
{
- if (rb->Data) {
- free(rb->Data);
- }
- free(rb);
+ /* no-op */
}
diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index a78c6a191b9..825214c95df 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -156,6 +156,20 @@ soft_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
}
+/**
+ * Called via gl_renderbuffer::Delete()
+ */
+static void
+soft_renderbuffer_delete(struct gl_renderbuffer *rb)
+{
+ if (rb->Data) {
+ free(rb->Data);
+ rb->Data = NULL;
+ }
+ free(rb);
+}
+
+
void
_swrast_map_soft_renderbuffer(struct gl_context *ctx,
struct gl_renderbuffer *rb,
@@ -198,6 +212,7 @@ _swrast_new_soft_renderbuffer(struct gl_context *ctx, GLuint name)
struct gl_renderbuffer *rb = _mesa_new_renderbuffer(ctx, name);
if (rb) {
rb->AllocStorage = soft_renderbuffer_storage;
+ rb->Delete = soft_renderbuffer_delete;
}
return rb;
}