Skip to content

radv: round-up num_records division in radv_flush_vertex_descriptors

Rhys Perry requested to merge pendingchaos/mesa:radv_round_up_num_records into master

Vertex attribute bounds checking is supposed to be done per-attribute:

   is_oob = index * stride + attrib_offset + attrib_size > buffer_size

but we were obtaining num_records by dividing the buffer size by the stride, making it per-vertex:

   is_oob = index * stride + (stride - 1) >= buffer_size

An example from Dead Cells (Wine) is:

attribute bindings: 0, 1, 2
attribute formats: r32g32, r32g32, r32g32b32a32
attribute offsets: 0, 0, 0
binding buffers: all the same buffer
binding offsets: 0, 8, 16
binding sizes: 128, 120, 112
binding strides: 32, 32, 32

Workaround this issue without switching to per-attribute descriptors by rounding up the division. This is still incorrect, but it should now no longer consider in-bounds attributes out-of-bounds.

Merge request reports