summaryrefslogtreecommitdiffstats
path: root/src/gallium
diff options
context:
space:
mode:
authorWladimir J. van der Laan <[email protected]>2013-10-03 12:32:12 +0200
committerMarge Bot <[email protected]>2019-12-21 18:29:30 +0000
commit87a6029ccf531d5d7400664d89ca2356760f87ec (patch)
treef051bfa8caf43cb41f825328678cce9afb9a99fb /src/gallium
parent18a8c3f7f11307b348f72c64603b5761c0ce406f (diff)
u_vbuf: use single vertex buffer if it's not possible to have multiple
Put CONST, VERTEX and INSTANCE attributes into one vertex buffer if necessary due to hardware constraints. Signed-off-by: Wladimir J. van der Laan <[email protected]> Signed-off-by: Paul Cercueil <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2807>
Diffstat (limited to 'src/gallium')
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index 8e67cd965f8..f0a21f43648 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -541,16 +541,24 @@ u_vbuf_translate_find_free_vb_slots(struct u_vbuf *mgr,
uint32_t unused_vb_mask =
mgr->ve->incompatible_vb_mask_all | mgr->incompatible_vb_mask |
~mgr->enabled_vb_mask;
+ uint32_t unused_vb_mask_orig;
+ boolean insufficient_buffers = false;
+
+ /* No vertex buffers available at all */
+ if (!unused_vb_mask)
+ return FALSE;
memset(fallback_vbs, ~0, sizeof(fallback_vbs));
/* Find free slots for each type if needed. */
+ unused_vb_mask_orig = unused_vb_mask;
for (type = 0; type < VB_NUM; type++) {
if (mask[type]) {
uint32_t index;
if (!unused_vb_mask) {
- return FALSE;
+ insufficient_buffers = true;
+ break;
}
index = ffs(unused_vb_mask) - 1;
@@ -560,6 +568,17 @@ u_vbuf_translate_find_free_vb_slots(struct u_vbuf *mgr,
}
}
+ if (insufficient_buffers) {
+ /* not enough vbs for all types supported by the hardware, they will have to share one
+ * buffer */
+ uint32_t index = ffs(unused_vb_mask_orig) - 1;
+ /* When sharing one vertex buffer use per-vertex frequency for everything. */
+ fallback_vbs[VB_VERTEX] = index;
+ mask[VB_VERTEX] = mask[VB_VERTEX] | mask[VB_CONST] | mask[VB_INSTANCE];
+ mask[VB_CONST] = 0;
+ mask[VB_INSTANCE] = 0;
+ }
+
for (type = 0; type < VB_NUM; type++) {
if (mask[type]) {
mgr->dirty_real_vb_mask |= 1 << fallback_vbs[type];