From 8a1ce9a1447f23e50f0dc9042afae16c4aac3e52 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 27 Sep 2024 14:00:22 -0400 Subject: [PATCH] util/vbuf: delete/fix broken incompatible stride calc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this was accidentally duplicated from the conditional below, except this one didn't have the buffer_stride_unaligned caps check, which meant any 4-byte attrib which was unaligned got marked for rewrites even on drivers supporting unaligned strides the correct change should have checked the stride against the component size in the top case Fixes: 76725452239 ("gallium: move vertex stride to CSO") Acked-by: Marek Olšák Part-of: --- src/gallium/auxiliary/util/u_vbuf.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c index 9809bcc2388..acc07ee5454 100644 --- a/src/gallium/auxiliary/util/u_vbuf.c +++ b/src/gallium/auxiliary/util/u_vbuf.c @@ -932,20 +932,17 @@ u_vbuf_create_vertex_elements(struct u_vbuf *mgr, unsigned count, ve->compatible_vb_mask_any |= vb_index_bit; if (component_size == 2) { ve->vb_align_mask[0] |= vb_index_bit; - if (ve->ve[i].src_stride % 2 != 0) - ve->incompatible_vb_mask |= vb_index_bit; } else if (component_size == 4) { ve->vb_align_mask[1] |= vb_index_bit; - if (ve->ve[i].src_stride % 4 != 0) - ve->incompatible_vb_mask |= vb_index_bit; } } ve->strides[ve->ve[i].vertex_buffer_index] = ve->ve[i].src_stride; if (ve->ve[i].src_stride) { ve->nonzero_stride_vb_mask |= 1 << ve->ve[i].vertex_buffer_index; } - if (!mgr->caps.buffer_stride_unaligned && ve->ve[i].src_stride % 4 != 0) + if ((!mgr->caps.buffer_stride_unaligned && ve->ve[i].src_stride % 4 != 0) || + (!mgr->caps.attrib_component_unaligned && ve->ve[i].src_stride % component_size != 0)) ve->incompatible_vb_mask |= vb_index_bit; }