summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/vc4/vc4_draw.c
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2014-10-18 12:50:05 +0100
committerEric Anholt <[email protected]>2014-10-19 08:44:56 +0100
commit6212d2402df4ad0658cbb98ce889e35ef5f32fa3 (patch)
tree23b3d5128082694cf8c62c2f62ff779475f0b776 /src/gallium/drivers/vc4/vc4_draw.c
parent572fba95e4cd85aebdde9bd757c17f719af2af04 (diff)
vc4: Translate 4-byte index buffers to 2 bytes.
Fixes assertion failures in 14 piglit tests (half of which now pass).
Diffstat (limited to 'src/gallium/drivers/vc4/vc4_draw.c')
-rw-r--r--src/gallium/drivers/vc4/vc4_draw.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gallium/drivers/vc4/vc4_draw.c b/src/gallium/drivers/vc4/vc4_draw.c
index f53caf79cfb..e70506b6245 100644
--- a/src/gallium/drivers/vc4/vc4_draw.c
+++ b/src/gallium/drivers/vc4/vc4_draw.c
@@ -209,19 +209,23 @@ vc4_draw_vbo(struct pipe_context *pctx, const struct pipe_draw_info *info)
*/
if (info->indexed) {
struct vc4_resource *rsc = vc4_resource(vc4->indexbuf.buffer);
-
- assert(vc4->indexbuf.index_size == 1 ||
- vc4->indexbuf.index_size == 2);
+ uint32_t offset = vc4->indexbuf.offset;
+ uint32_t index_size = vc4->indexbuf.index_size;
+ if (rsc->shadow_parent) {
+ vc4_update_shadow_index_buffer(pctx, &vc4->indexbuf);
+ offset = 0;
+ index_size = 2;
+ }
cl_start_reloc(&vc4->bcl, 1);
cl_u8(&vc4->bcl, VC4_PACKET_GL_INDEXED_PRIMITIVE);
cl_u8(&vc4->bcl,
info->mode |
- (vc4->indexbuf.index_size == 2 ?
+ (index_size == 2 ?
VC4_INDEX_BUFFER_U16:
VC4_INDEX_BUFFER_U8));
cl_u32(&vc4->bcl, info->count);
- cl_reloc(vc4, &vc4->bcl, rsc->bo, vc4->indexbuf.offset);
+ cl_reloc(vc4, &vc4->bcl, rsc->bo, offset);
cl_u32(&vc4->bcl, max_index);
} else {
cl_u8(&vc4->bcl, VC4_PACKET_GL_ARRAY_PRIMITIVE);