util/vbuf: delete/fix broken incompatible stride calc

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: 7672545223 ("gallium: move vertex stride to CSO")

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31425>
(cherry picked from commit 8a1ce9a144)
This commit is contained in:
Mike Blumenkrantz 2024-09-27 14:00:22 -04:00 committed by Eric Engestrom
parent 35f27de9da
commit 8512574ccc
2 changed files with 3 additions and 6 deletions

View file

@ -354,7 +354,7 @@
"description": "util/vbuf: delete/fix broken incompatible stride calc",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "76725452239e9e7740c0edd6a5f3663ab897c343",
"notes": null

View file

@ -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;
}