Skip to content

mesa: fix glBindVertexBuffer(0, 0, 0, 0)

Chia-I Wu requested to merge olv/mesa:stride-0-fix into main

When an app calls glBindVertexBuffer(0, 0, 0, 0) followed by a draw, Mesa crashes in st_update_array_with_popcnt on a release build. On a debug build, it hits this assert failure on src/mesa/main/arrayobj.c:800:

assert(attrib->_EffRelativeOffset < binding->Stride);

because binding->Stride is 0.

Commenting the line out results in another assert failure on src/mesa/state_tracker/st_atom_array.cpp:161:

assert(attrmask);

The root cause seems to be Mesa's assumption that user buffers have positive strides. Fix up stride in _mesa_bind_vertex_buffer to meet the assumption.

Merge request reports