summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300/r300_render.c
diff options
context:
space:
mode:
authorƁukasz Krotowski <[email protected]>2010-01-14 10:05:02 +0100
committerCorbin Simpson <[email protected]>2010-01-14 09:01:37 -0800
commit60628c65c902f68c600b3d79c06e928aa3286285 (patch)
tree6d96efa8d88049ddac29afd61658b2b2da8d03ae /src/gallium/drivers/r300/r300_render.c
parent7fcfb7193107f192bcadccd50115a5216f98d567 (diff)
r300g: Really destroy translated buffer at the end.
Note that indexSize is changed by r300_translate_elts(). Also make sure it's destroyed on errors.
Diffstat (limited to 'src/gallium/drivers/r300/r300_render.c')
-rw-r--r--src/gallium/drivers/r300/r300_render.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index 6645688fc58..528741ab7c0 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -316,6 +316,7 @@ void r300_draw_range_elements(struct pipe_context* pipe,
return;
}
+ struct pipe_buffer* orgIndexBuffer = indexBuffer;
if (indexSize == 1) {
indexBuffer = r300_translate_elts(r300, indexBuffer,
&indexSize, &mode, &count);
@@ -323,11 +324,11 @@ void r300_draw_range_elements(struct pipe_context* pipe,
if (!r300->winsys->add_buffer(r300->winsys, indexBuffer,
RADEON_GEM_DOMAIN_GTT, 0)) {
- return;
+ goto cleanup;
}
if (!r300->winsys->validate(r300->winsys)) {
- return;
+ goto cleanup;
}
r300_emit_dirty_state(r300);
@@ -337,7 +338,8 @@ void r300_draw_range_elements(struct pipe_context* pipe,
r300_emit_draw_elements(r300, indexBuffer, indexSize, minIndex, maxIndex,
mode, start, count);
- if (indexSize == 1) {
+cleanup:
+ if (indexBuffer != orgIndexBuffer) {
pipe->screen->buffer_destroy(indexBuffer);
}
}