OSDN Git Service

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)
committerEmil Velikov <emil.l.velikov@gmail.com>
Wed, 1 Mar 2017 13:34:40 +0000 (13:34 +0000)
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>
(cherry picked from commit a264fee6245856340fab9024e1a428626e966335)
[Emil Velikov: resolve trivial conflicts]
Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
Conflicts:
src/gallium/drivers/radeonsi/si_state_draw.c

src/gallium/drivers/radeonsi/si_state_draw.c

index d296874..4bd087c 100644 (file)
@@ -1060,7 +1060,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;
 
                        u_upload_alloc(sctx->b.uploader, start_offset, count * 2, 256,
                                       &out_offset, &out_buffer, &ptr);
@@ -1070,7 +1070,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);