From 9cc0834ca604638081ae6c295050c657625086c6 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Sat, 24 Jul 2021 18:00:39 -0400 Subject: [PATCH] asahi: Generalize src_offset for non-4byte formats Signed-off-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/asahi/agx_state.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gallium/drivers/asahi/agx_state.c b/src/gallium/drivers/asahi/agx_state.c index ac39f8d..6ac4214 100644 --- a/src/gallium/drivers/asahi/agx_state.c +++ b/src/gallium/drivers/asahi/agx_state.c @@ -802,12 +802,15 @@ agx_create_vertex_elements(struct pipe_context *ctx, const struct util_format_description *desc = util_format_description(ve.src_format); + unsigned chan_size = desc->channel[0].size / 8; + + assert(chan_size == 1 || chan_size == 2 || chan_size == 4); assert(desc->nr_channels >= 1 && desc->nr_channels <= 4); - assert((ve.src_offset & 0x3) == 0); + assert((ve.src_offset & (chan_size - 1)) == 0); attribs[i] = (struct agx_attribute) { .buf = ve.vertex_buffer_index, - .src_offset = ve.src_offset / 4, + .src_offset = ve.src_offset / chan_size, .nr_comps_minus_1 = desc->nr_channels - 1, .format = agx_vertex_format[ve.src_format], .divisor = ve.instance_divisor -- 2.7.4