r600g: fix index buffer drawing
authorJerome Glisse <jglisse@redhat.com>
Mon, 27 Sep 2010 13:01:55 +0000 (09:01 -0400)
committerJerome Glisse <jglisse@redhat.com>
Mon, 27 Sep 2010 13:59:52 +0000 (09:59 -0400)
Signed-off-by: Jerome Glisse <jglisse@redhat.com>
src/gallium/drivers/r600/evergreen_state.c
src/gallium/drivers/r600/r600_state2.c

index b0b0f5ce776ab67023bd6537cb06d5191e103b47..89f7c7f53a4a5f5d39089fc81d4e8853d277cf3c 100644 (file)
@@ -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);
 }
index e5b2dc99274f29ee08371f60f3116be6edff5028..8bf8d24549c009694d964b4813567f0d207ba64e 100644 (file)
@@ -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);
        }