Mesa (master): nv50: avoid segfault with enabled but unbound vertex attrib

Samuel Pitoiset hakzsam at kemper.freedesktop.org
Wed Jul 8 19:05:52 UTC 2015


Module: Mesa
Branch: master
Commit: adc816a1e41812e6489a5bc388f80de65504be5b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=adc816a1e41812e6489a5bc388f80de65504be5b

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Mon Jul  6 23:34:23 2015 +0200

nv50: avoid segfault with enabled but unbound vertex attrib

Before validating vertex arrays we need to check if a VBO is present.
Checking if vb->buffer is not NULL fixes the issue.

Fixes the following piglit test:
  gl-3.1-vao-broken-attrib

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/gallium/drivers/nouveau/nv50/nv50_vbo.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
index 1fd33b8..3d200bd 100644
--- a/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
+++ b/src/gallium/drivers/nouveau/nv50/nv50_vbo.c
@@ -382,6 +382,11 @@ nv50_vertex_arrays_validate(struct nv50_context *nv50)
       if (nv50->vbo_user & (1 << b)) {
          address = addrs[b] + ve->pipe.src_offset;
          limit = addrs[b] + limits[b];
+      } else
+      if (!vb->buffer) {
+         BEGIN_NV04(push, NV50_3D(VERTEX_ARRAY_FETCH(i)), 1);
+         PUSH_DATA (push, 0);
+         continue;
       } else {
          struct nv04_resource *buf = nv04_resource(vb->buffer);
          if (!(refd & (1 << b))) {




More information about the mesa-commit mailing list