gallium/aux: reorder vertex attributes in triangle fans according to PV
authorGert Wollny <gert.wollny@collabora.com>
Tue, 14 Jul 2020 13:28:00 +0000 (15:28 +0200)
committerMarge Bot <eric+marge@anholt.net>
Tue, 18 Aug 2020 12:12:27 +0000 (12:12 +0000)
With triangle fans when "first vertex convention" is active the
provoking vertex is actually the second vertex so that the different
triangle can have different colors with flat shading. Take this into
account when re-ordering the vertex indices (as proposed by Erik)

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5976>

src/gallium/auxiliary/indices/u_indices_gen.py

index 2d08072c41aab233b195c6dc4d15a45d2f94ea27..3c64bb213e48699196a55a73ca7e2736bb50ff79 100644 (file)
@@ -294,7 +294,11 @@ def trifan(intype, outtype, inpv, outpv, pr):
             print('         start = i;')
         prim_restart(3, 3, 1, close_func)
 
-    do_tri( intype, outtype, 'out+j',  'start', 'i+1', 'i+2', inpv, outpv );
+    if inpv == FIRST:
+        do_tri( intype, outtype, 'out+j',  'i+1', 'i+2', 'start', inpv, outpv );
+    else:
+        do_tri( intype, outtype, 'out+j',  'start', 'i+1', 'i+2', inpv, outpv );
+
     print('   }')
     postamble()