summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Cercueil <[email protected]>2019-11-19 22:10:10 +0100
committerMarge Bot <[email protected]>2019-12-21 18:29:30 +0000
commitc6ef79c488bb5fffde31e7065fd3e575f3c25fb5 (patch)
treedea8fc13bfe3fa64c0b4707d95eac715e343f582 /src
parent87a6029ccf531d5d7400664d89ca2356760f87ec (diff)
u_vbuf: Regard non-constant vbufs with non-instance elements as free
In the case of unroll_indices, we can regard all non-constant vertex buffers with only non-instance vertex elements as incompatible and thus free. 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')
-rw-r--r--src/gallium/auxiliary/util/u_vbuf.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/gallium/auxiliary/util/u_vbuf.c b/src/gallium/auxiliary/util/u_vbuf.c
index f0a21f43648..8ad6346d547 100644
--- a/src/gallium/auxiliary/util/u_vbuf.c
+++ b/src/gallium/auxiliary/util/u_vbuf.c
@@ -533,14 +533,15 @@ u_vbuf_translate_buffers(struct u_vbuf *mgr, struct translate_key *key,
static boolean
u_vbuf_translate_find_free_vb_slots(struct u_vbuf *mgr,
- unsigned mask[VB_NUM])
+ unsigned mask[VB_NUM],
+ unsigned extra_free_vb_mask)
{
unsigned type;
unsigned fallback_vbs[VB_NUM];
/* Set the bit for each buffer which is incompatible, or isn't set. */
uint32_t unused_vb_mask =
- mgr->ve->incompatible_vb_mask_all | mgr->incompatible_vb_mask |
- ~mgr->enabled_vb_mask;
+ (mgr->ve->incompatible_vb_mask_all | mgr->incompatible_vb_mask |
+ ~mgr->enabled_vb_mask | extra_free_vb_mask) & mgr->allowed_vb_mask;
uint32_t unused_vb_mask_orig;
boolean insufficient_buffers = false;
@@ -601,6 +602,7 @@ u_vbuf_translate_begin(struct u_vbuf *mgr,
unsigned i, type;
const unsigned incompatible_vb_mask = mgr->incompatible_vb_mask &
mgr->ve->used_vb_mask;
+ unsigned extra_free_vb_mask = 0;
const int start[VB_NUM] = {
start_vertex, /* VERTEX */
@@ -646,8 +648,15 @@ u_vbuf_translate_begin(struct u_vbuf *mgr,
assert(mask[VB_VERTEX] || mask[VB_INSTANCE] || mask[VB_CONST]);
+ /* In the case of unroll_indices, we can regard all non-constant
+ * vertex buffers with only non-instance vertex elements as incompatible
+ * and thus free.
+ */
+ if (unroll_indices)
+ extra_free_vb_mask = mask[VB_VERTEX] & ~mask[VB_INSTANCE];
+
/* Find free vertex buffer slots. */
- if (!u_vbuf_translate_find_free_vb_slots(mgr, mask)) {
+ if (!u_vbuf_translate_find_free_vb_slots(mgr, mask, extra_free_vb_mask)) {
return FALSE;
}