radeonsi: fix UNSIGNED_BYTE index buffer fallback with non-zero start (v2)
authorMarek Olšák <marek.olsak@amd.com>
Wed, 15 Feb 2017 16:24:38 +0000 (17:24 +0100)
committerMarek Olšák <marek.olsak@amd.com>
Sun, 19 Feb 2017 16:16:26 +0000 (17:16 +0100)
start can only be non-zero with MultiDrawElements, which is unlikely
to occur with UNSIGNED_BYTE indices.

v2: Also fix the util_shorten_ubyte_elts_to_userptr call.
    Tested with the new piglit.

Cc: mesa-stable@lists.freedesktop.org
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/radeonsi/si_state_draw.c

index 34a44cc31fde254fb72f4db99a16440e77a96a6b..c463fef835c6c4c896161e90066e95bae42b78c5 100644 (file)
@@ -1052,7 +1052,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
                        void *ptr;
 
                        si_get_draw_start_count(sctx, info, &start, &count);
-                       start_offset = start * ib.index_size;
+                       start_offset = start * 2;
                        size = count * 2;
 
                        u_upload_alloc(ctx->stream_uploader, start_offset,
@@ -1065,7 +1065,7 @@ void si_draw_vbo(struct pipe_context *ctx, const struct pipe_draw_info *info)
                        }
 
                        util_shorten_ubyte_elts_to_userptr(&sctx->b.b, &ib, 0,
-                                                          ib.offset + start_offset,
+                                                          ib.offset + start,
                                                           count, ptr);
 
                        pipe_resource_reference(&ib.buffer, NULL);