r600g: do not destroy the original index buffer when translating indices
authorMarek Olšák <maraeo@gmail.com>
Mon, 14 Feb 2011 05:59:00 +0000 (06:59 +0100)
committerMarek Olšák <maraeo@gmail.com>
Mon, 14 Feb 2011 06:45:14 +0000 (07:45 +0100)
Because we only translate a subrange of the buffer.

src/gallium/drivers/r600/r600_state_common.c

index bcaf2b9e45e3d26cbbeb07fbbe000acad8c269b3..72707fbd8b8b687a6e9ebc6c9c6c8b6a7a6d2d56 100644 (file)
@@ -449,14 +449,14 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
        draw.ctx = ctx;
        if (info->indexed && rctx->index_buffer.buffer) {
                draw.info.start += rctx->index_buffer.offset / rctx->index_buffer.index_size;
+               pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer);
 
-               r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer,
+               r600_translate_index_buffer(rctx, &draw.index_buffer,
                                            &rctx->index_buffer.index_size,
                                            &draw.info.start,
                                            info->count);
 
                draw.index_size = rctx->index_buffer.index_size;
-               pipe_resource_reference(&draw.index_buffer, rctx->index_buffer.buffer);
                draw.index_buffer_offset = draw.info.start * draw.index_size;
                draw.info.start = 0;