Mesa (master): draw: fix vs/fs input/output mismatches

Zack Rusin zack at kemper.freedesktop.org
Thu May 30 19:34:26 UTC 2013


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

Author: Zack Rusin <zackr at vmware.com>
Date:   Thu May 30 13:48:36 2013 -0400

draw: fix vs/fs input/output mismatches

When we've changed draw_find_shader_output to return -1 instead
of 0 on non found attribs we broke the default behavior of
draw, which was to always redirect those to the first (0th) slot.
To preserve that behavior if draw_emit_vertex_attr notices a
mismatched vertex attrib, it just redirects it to the first slot
(instead of trying to use negative index in an array).

Signed-off-by: Zack Rusin <zackr at vmware.com>
Reviewed-by: José Fonseca <jfonseca at vmware.com>

---

 src/gallium/auxiliary/draw/draw_vertex.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/gallium/auxiliary/draw/draw_vertex.h b/src/gallium/auxiliary/draw/draw_vertex.h
index 9e10ada..2e726e0 100644
--- a/src/gallium/auxiliary/draw/draw_vertex.h
+++ b/src/gallium/auxiliary/draw/draw_vertex.h
@@ -128,6 +128,13 @@ draw_emit_vertex_attr(struct vertex_info *vinfo,
                       int src_index)
 {
    const uint n = vinfo->num_attribs;
+
+   /* If the src_index is negative, meaning it hasn't been found
+    * lets just redirect it to the first output slot */
+   if (src_index < 0) {
+      src_index = 0;
+   }
+
    assert(n < Elements(vinfo->attrib));
    vinfo->attrib[n].emit = emit;
    vinfo->attrib[n].interp_mode = interp;




More information about the mesa-commit mailing list