From 7e752760d410e72cc766691bee207729f28a920a Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 25 Dec 2010 14:46:45 +0100 Subject: r300g: simplify the code for buffer uploads --- src/gallium/drivers/r300/r300_render.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/gallium/drivers/r300/r300_render.c') diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c index 142538b3657..92d12743a45 100644 --- a/src/gallium/drivers/r300/r300_render.c +++ b/src/gallium/drivers/r300/r300_render.c @@ -592,15 +592,16 @@ static void r300_draw_range_elements(struct pipe_context* pipe, * The start index will be aligned simply from the fact that * every sub-buffer in u_upload_mgr is aligned. */ userbuf = pipe->screen->user_buffer_create(pipe->screen, - ptr + start, count * 2, + ptr, count * 2, PIPE_BIND_INDEX_BUFFER); indexBuffer = userbuf; - r300_upload_index_buffer(r300, &indexBuffer, indexSize, 0, count, &start); + r300_upload_index_buffer(r300, &indexBuffer, indexSize, &start, count); pipe_resource_reference(&userbuf, NULL); } pipe_buffer_unmap(pipe, transfer); } else { - r300_upload_index_buffer(r300, &indexBuffer, indexSize, start, count, &start); + if (r300_buffer_is_user_buffer(indexBuffer)) + r300_upload_index_buffer(r300, &indexBuffer, indexSize, &start, count); } /* 19 dwords for emit_draw_elements. Give up if the function fails. */ -- cgit v1.2.3