summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gallium/drivers/r600/r600_context.h1
-rw-r--r--src/gallium/drivers/r600/r600_draw.c11
-rw-r--r--src/gallium/drivers/r600/r600_hw_states.c2
3 files changed, 8 insertions, 6 deletions
diff --git a/src/gallium/drivers/r600/r600_context.h b/src/gallium/drivers/r600/r600_context.h
index 8778f23a81..c15e64329d 100644
--- a/src/gallium/drivers/r600/r600_context.h
+++ b/src/gallium/drivers/r600/r600_context.h
@@ -129,6 +129,7 @@ struct r600_draw {
struct pipe_resource *index_buffer;
unsigned index_buffer_offset;
unsigned min_index, max_index;
+ unsigned index_bias;
};
struct r600_context_hw_states {
diff --git a/src/gallium/drivers/r600/r600_draw.c b/src/gallium/drivers/r600/r600_draw.c
index 0fa48ae23a..4978a3cab2 100644
--- a/src/gallium/drivers/r600/r600_draw.c
+++ b/src/gallium/drivers/r600/r600_draw.c
@@ -149,8 +149,6 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
struct r600_draw draw;
int r;
- assert(info->index_bias == 0);
-
memset(&draw, 0, sizeof(draw));
if (rctx->any_user_vbs) {
@@ -166,16 +164,17 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
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;
r600_translate_index_buffer(rctx, &rctx->index_buffer.buffer,
&rctx->index_buffer.index_size,
- rctx->index_buffer.offset, &draw.start,
+ 0, &draw.start,
info->count);
draw.index_size = rctx->index_buffer.index_size;
draw.index_buffer = rctx->index_buffer.buffer;
- draw.index_buffer_offset = rctx->index_buffer.offset;
-
+ draw.index_buffer_offset = draw.start * draw.index_size;
+ draw.start = 0;
r600_upload_index_buffer(rctx, &draw);
}
else {
@@ -184,7 +183,9 @@ void r600_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
draw.min_index = 0;
draw.max_index = 0xffffff;
draw.index_buffer_offset = 0;
+ draw.index_bias = draw.start;
}
+
r = r600_draw_common(&draw);
if (r)
fprintf(stderr,"draw common failed %d\n", r);
diff --git a/src/gallium/drivers/r600/r600_hw_states.c b/src/gallium/drivers/r600/r600_hw_states.c
index 9e54c6a921..1e9c5ffbfc 100644
--- a/src/gallium/drivers/r600/r600_hw_states.c
+++ b/src/gallium/drivers/r600/r600_hw_states.c
@@ -983,7 +983,7 @@ static int r600_draw_vgt_prim(struct r600_draw *draw,
draw->vgt.states[R600_VGT__VGT_PRIMITIVE_TYPE] = prim;
draw->vgt.states[R600_VGT__VGT_MAX_VTX_INDX] = draw->max_index;
draw->vgt.states[R600_VGT__VGT_MIN_VTX_INDX] = draw->min_index;
- draw->vgt.states[R600_VGT__VGT_INDX_OFFSET] = draw->start;
+ draw->vgt.states[R600_VGT__VGT_INDX_OFFSET] = draw->index_bias;
draw->vgt.states[R600_VGT__VGT_MULTI_PRIM_IB_RESET_INDX] = 0x00000000;
draw->vgt.states[R600_VGT__VGT_DMA_INDEX_TYPE] = vgt_dma_index_type;
draw->vgt.states[R600_VGT__VGT_PRIMITIVEID_EN] = 0x00000000;