[Mesa-dev] [PATCH 3/3] radeonsi: fix leaking the null constant buffer
Christian König
deathsimple at vodafone.de
Sat Mar 8 04:21:32 PST 2014
From: Christian König <christian.koenig at amd.com>
Signed-off-by: Christian König <christian.koenig at amd.com>
---
src/gallium/drivers/radeonsi/si_pipe.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index 5bc86bb..7e8e09b 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -80,6 +80,13 @@ static void si_destroy_context(struct pipe_context *context)
si_release_all_descriptors(sctx);
+ for (int shader = 0; shader < SI_NUM_SHADERS; shader++) {
+ struct si_buffer_resources *buffers = &sctx->const_buffers[shader];
+ for (int i = 0; i < NUM_CONST_BUFFERS; i++) {
+ pipe_resource_reference(&buffers->buffers[i], NULL);
+ }
+ }
+
pipe_resource_reference(&sctx->null_const_buf.buffer, NULL);
r600_resource_reference(&sctx->border_color_table, NULL);
@@ -190,8 +197,7 @@ static struct pipe_context *si_create_context(struct pipe_screen *screen, void *
for (shader = 0; shader < SI_NUM_SHADERS; shader++) {
for (i = 0; i < NUM_CONST_BUFFERS; i++) {
- sctx->b.b.set_constant_buffer(&sctx->b.b, shader, i,
- &sctx->null_const_buf);
+ sctx->b.b.set_constant_buffer(&sctx->b.b, shader, i, NULL);
}
}
--
1.8.3.2
More information about the mesa-dev
mailing list