u_vbuf: Mark vbufs incompatible if more were requested than HW supports
authorPaul Cercueil <paul@crapouillou.net>
Tue, 19 Nov 2019 20:58:17 +0000 (21:58 +0100)
committerMarge Bot <eric+marge@anholt.net>
Sat, 21 Dec 2019 18:29:30 +0000 (18:29 +0000)
More vertex buffers are used than the hardware supports.  In
principle, we only need to make sure that less vertex buffers are
used, and mark some of the latter vertex buffers as incompatible.
For now, mark all vertex buffers as incompatible.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807>

src/gallium/auxiliary/util/u_vbuf.c

index e69e9fd20a0e6d1494078f5d84dadbc6bb36dc60..67c82a56ecd865fcea81e50706cd05c295d31df5 100644 (file)
@@ -788,6 +788,17 @@ u_vbuf_create_vertex_elements(struct u_vbuf *mgr, unsigned count,
       }
    }
 
+   if (used_buffers & ~mgr->allowed_vb_mask) {
+      /* More vertex buffers are used than the hardware supports.  In
+       * principle, we only need to make sure that less vertex buffers are
+       * used, and mark some of the latter vertex buffers as incompatible.
+       * For now, mark all vertex buffers as incompatible.
+       */
+      ve->incompatible_vb_mask_any = used_buffers;
+      ve->compatible_vb_mask_any = 0;
+      ve->incompatible_elem_mask = u_bit_consecutive(0, count);
+   }
+
    ve->used_vb_mask = used_buffers;
    ve->compatible_vb_mask_all = ~ve->incompatible_vb_mask_any & used_buffers;
    ve->incompatible_vb_mask_all = ~ve->compatible_vb_mask_any & used_buffers;