nine: avoid using post-compacted indices with state expecting pre-compacted ones

The commit 973e6f3b implemented compaction of the stream-number space. The
functions `update_vertex_elements(_sw)` began using the post-compacted
stream-numbers/indices when maintaining the `stream_usage_mask` and
when reading from the arrays `vtxstride` and `stream_freq`.

But, the `stream_instancedata_mask`, with which the `stream_usage_mask`
is compared/bitwise-anded, maintains bits for the pre-compacted indices.
Additionally, the information within the arrays is stored using the
pre-compacted indices.

The functions have a disagreement, regarding the type (pre- vs post-
compacted) of indices, with the rest of the relevant source. This change
removes the disagreement by having them use pre-compacted indices when
maintaining the `stream_usage_mask` and when reading from the arrays.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11283
Fixes: 973e6f3b ("gallium: remove start_slot parameter from pipe_context::set_vertex_buffers")
Reviewed-by: Axel Davy <davyaxel0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29704>
This commit is contained in:
Amol Surati
2024-06-13 06:47:20 +05:30
committed by Marge Bot
parent 0bee32a4c3
commit 4bf330471b
+2 -4
View File
@@ -901,9 +901,8 @@ update_vertex_elements(struct NineDevice9 *device)
index = vdecl_index_map[n];
if (index >= 0) {
ve.velems[n] = vdecl->elems[index];
ve.velems[n].vertex_buffer_index =
vtxbuf_holes_map[ve.velems[n].vertex_buffer_index];
b = ve.velems[n].vertex_buffer_index;
ve.velems[n].vertex_buffer_index = vtxbuf_holes_map[b];
ve.velems[n].src_stride = context->vtxstride[b];
context->stream_usage_mask |= 1 << b;
/* XXX wine just uses 1 here: */
@@ -3173,9 +3172,8 @@ update_vertex_elements_sw(struct NineDevice9 *device)
index = vdecl_index_map[n];
if (index >= 0) {
ve.velems[n] = vdecl->elems[index];
ve.velems[n].vertex_buffer_index =
vtxbuf_holes_map[ve.velems[n].vertex_buffer_index];
b = ve.velems[n].vertex_buffer_index;
ve.velems[n].vertex_buffer_index = vtxbuf_holes_map[b];
/* XXX wine just uses 1 here: */
if (state->stream_freq[b] & D3DSTREAMSOURCE_INSTANCEDATA)
ve.velems[n].instance_divisor = state->stream_freq[b] & 0x7FFFFF;