Mesa (9.1): radeonsi: Fix draws using user index buffer.

Michel Dänzer daenzer at kemper.freedesktop.org
Mon Feb 4 17:09:10 UTC 2013


Module: Mesa
Branch: 9.1
Commit: 7f90de54142647966169165079a952ce648ddb06
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=7f90de54142647966169165079a952ce648ddb06

Author: Michel Dänzer <michel.daenzer at amd.com>
Date:   Fri Feb  1 18:49:07 2013 +0100

radeonsi: Fix draws using user index buffer.

Was broken since commit bf469f4edc60bd1c5fd770cb231b8d5ab801427f
('gallium: add void *user_buffer in pipe_index_buffer').

Fixes 11 piglit tests and lots of missing geometry e.g. in TORCS.

NOTE: This is a candidate for the 9.1 branch.
(cherry picked from commit a8a5055f2dea1960898763d17f28043577c3e64e)

---

 src/gallium/drivers/radeonsi/si_state_draw.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index ef94eae..3704410 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -524,10 +524,8 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 	struct pipe_index_buffer ib = {};
 	uint32_t cp_coher_cntl;
 
-	if ((!info->count && (info->indexed || !info->count_from_stream_output)) ||
-	    (info->indexed && !rctx->index_buffer.buffer)) {
+	if (!info->count && (info->indexed || !info->count_from_stream_output))
 		return;
-	}
 
 	if (!rctx->ps_shader || !rctx->vs_shader)
 		return;
@@ -538,13 +536,14 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
 	if (info->indexed) {
 		/* Initialize the index buffer struct. */
 		pipe_resource_reference(&ib.buffer, rctx->index_buffer.buffer);
+		ib.user_buffer = rctx->index_buffer.user_buffer;
 		ib.index_size = rctx->index_buffer.index_size;
 		ib.offset = rctx->index_buffer.offset + info->start * ib.index_size;
 
 		/* Translate or upload, if needed. */
 		r600_translate_index_buffer(rctx, &ib, info->count);
 
-		if (ib.user_buffer) {
+		if (ib.user_buffer && !ib.buffer) {
 			r600_upload_index_buffer(rctx, &ib, info->count);
 		}
 




More information about the mesa-commit mailing list