From: Jerome Glisse Date: Mon, 27 Sep 2010 13:01:55 +0000 (-0400) Subject: r600g: fix index buffer drawing X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=58a31758e3b8249b12f0e797034bec235343aa15;p=mesa.git r600g: fix index buffer drawing Signed-off-by: Jerome Glisse --- diff --git a/src/gallium/drivers/r600/evergreen_state.c b/src/gallium/drivers/r600/evergreen_state.c index b0b0f5ce776..89f7c7f53a4 100644 --- a/src/gallium/drivers/r600/evergreen_state.c +++ b/src/gallium/drivers/r600/evergreen_state.c @@ -1349,6 +1349,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) draw.start = info->start; draw.count = info->count; if (info->indexed && rctx->index_buffer.buffer) { + draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size; draw.min_index = info->min_index; draw.max_index = info->max_index; draw.index_bias = info->index_bias; @@ -1495,7 +1496,7 @@ void evergreen_draw(struct pipe_context *ctx, const struct pipe_draw_info *info) if (draw.index_buffer) { rbuffer = (struct r600_resource*)draw.index_buffer; rdraw.indices = rbuffer->bo; - rdraw.indices_bo_offset = 0; + rdraw.indices_bo_offset = draw.index_buffer_offset; } evergreen_context_draw(&rctx->ctx, &rdraw); } diff --git a/src/gallium/drivers/r600/r600_state2.c b/src/gallium/drivers/r600/r600_state2.c index e5b2dc99274..8bf8d24549c 100644 --- a/src/gallium/drivers/r600/r600_state2.c +++ b/src/gallium/drivers/r600/r600_state2.c @@ -589,7 +589,7 @@ static void r600_draw_common(struct r600_drawl *draw) if (draw->index_buffer) { rbuffer = (struct r600_resource*)draw->index_buffer; rdraw.indices = rbuffer->bo; - rdraw.indices_bo_offset = 0; + rdraw.indices_bo_offset = draw->index_buffer_offset; } r600_context_draw(&rctx->ctx, &rdraw); } @@ -636,6 +636,7 @@ static void r600_draw_vbo2(struct pipe_context *ctx, const struct pipe_draw_info draw.start = info->start; draw.count = info->count; if (info->indexed && rctx->index_buffer.buffer) { + draw.start += rctx->index_buffer.offset / rctx->index_buffer.index_size; draw.min_index = info->min_index; draw.max_index = info->max_index; draw.index_bias = info->index_bias; @@ -677,7 +678,7 @@ static void r600_flush2(struct pipe_context *ctx, unsigned flags, #if 0 sprintf(dname, "gallium-%08d.bof", dc); - if (dc < 4) { + if (dc < 20) { r600_context_dump_bof(&rctx->ctx, dname); R600_ERR("dumped %s\n", dname); }