[Mesa-dev] [PATCH] cso: check count == 0 in cso_set_vertex_buffers

Marek Olšák maraeo at gmail.com
Tue May 15 02:35:15 UTC 2018


From: Marek Olšák <marek.olsak at amd.com>

The code didn't expect that.

Fixes: 86d63b53a20a747e "gallium: remove aux_vertex_buffer_slot code"
---
 src/gallium/auxiliary/cso_cache/cso_context.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/auxiliary/cso_cache/cso_context.c b/src/gallium/auxiliary/cso_cache/cso_context.c
index e3d46f3c8de..2543c5ff61f 100644
--- a/src/gallium/auxiliary/cso_cache/cso_context.c
+++ b/src/gallium/auxiliary/cso_cache/cso_context.c
@@ -1140,20 +1140,23 @@ cso_restore_vertex_elements(struct cso_context *ctx)
 }
 
 /* vertex buffers */
 
 void cso_set_vertex_buffers(struct cso_context *ctx,
                             unsigned start_slot, unsigned count,
                             const struct pipe_vertex_buffer *buffers)
 {
    struct u_vbuf *vbuf = ctx->vbuf;
 
+   if (!count)
+      return;
+
    if (vbuf) {
       u_vbuf_set_vertex_buffers(vbuf, start_slot, count, buffers);
       return;
    }
 
    /* Save what's in the auxiliary slot, so that we can save and restore it
     * for meta ops. */
    if (start_slot == 0) {
       if (buffers) {
          pipe_vertex_buffer_reference(&ctx->vertex_buffer0_current,
-- 
2.17.0



More information about the mesa-dev mailing list