summaryrefslogtreecommitdiffstats
path: root/src/mesa/swrast
diff options
context:
space:
mode:
authorTimothy Arceri <[email protected]>2017-04-08 10:35:57 +1000
committerTimothy Arceri <[email protected]>2017-04-10 10:55:34 +1000
commite6d6266e6f8c01f600be06b8e89f83fa7e1a1caa (patch)
tree23244eac69d4251f27cd14c37bddca5be1fdff58 /src/mesa/swrast
parent6c02387b2c882b69de542de81f3ed121665ae198 (diff)
swrast: take ownership rather than adding reference for new renderbuffers
This avoids locking in the reference calls and fixes a leak after the RefCount initialisation was change from 0 to 1. Fixes: 32141e53d1520 (mesa: tidy up renderbuffer RefCount initialisation) Reviewed-by: Emil Velikov <[email protected]>
Diffstat (limited to 'src/mesa/swrast')
-rw-r--r--src/mesa/swrast/s_renderbuffer.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c
index af09955484e..940c7b710c8 100644
--- a/src/mesa/swrast/s_renderbuffer.c
+++ b/src/mesa/swrast/s_renderbuffer.c
@@ -271,15 +271,10 @@ add_color_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
return GL_FALSE;
}
- /* Set refcount to 0 to avoid a leak since the _mesa_add_renderbuffer()
- * call below will bump the initial refcount.
- */
- rb->RefCount = 0;
-
rb->InternalFormat = GL_RGBA;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, b, rb);
+ _mesa_add_renderbuffer_without_ref(fb, b, rb);
}
return GL_TRUE;
@@ -325,7 +320,7 @@ add_depth_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
}
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
+ _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
return GL_TRUE;
}
@@ -363,7 +358,7 @@ add_stencil_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
rb->InternalFormat = GL_STENCIL_INDEX8;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
+ _mesa_add_renderbuffer_without_ref(fb, BUFFER_STENCIL, rb);
return GL_TRUE;
}
@@ -387,7 +382,7 @@ add_depth_stencil_renderbuffer(struct gl_context *ctx,
rb->InternalFormat = GL_DEPTH_STENCIL;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, BUFFER_DEPTH, rb);
+ _mesa_add_renderbuffer_without_ref(fb, BUFFER_DEPTH, rb);
_mesa_add_renderbuffer(fb, BUFFER_STENCIL, rb);
return GL_TRUE;
@@ -425,7 +420,7 @@ add_accum_renderbuffer(struct gl_context *ctx, struct gl_framebuffer *fb,
rb->InternalFormat = GL_RGBA16_SNORM;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, BUFFER_ACCUM, rb);
+ _mesa_add_renderbuffer_without_ref(fb, BUFFER_ACCUM, rb);
return GL_TRUE;
}
@@ -470,7 +465,7 @@ add_aux_renderbuffers(struct gl_context *ctx, struct gl_framebuffer *fb,
rb->InternalFormat = GL_RGBA;
rb->AllocStorage = soft_renderbuffer_storage;
- _mesa_add_renderbuffer(fb, BUFFER_AUX0 + i, rb);
+ _mesa_add_renderbuffer_without_ref(fb, BUFFER_AUX0 + i, rb);
}
return GL_TRUE;
}