Mesa (master): gallium/indices: use prim_restart-helper for polygon

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 18 12:28:43 UTC 2020


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

Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date:   Mon Jun 22 20:08:48 2020 +0200

gallium/indices: use prim_restart-helper for polygon

Reviewed-by: Gert Wollny <gert.wollny at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5976>

---

 src/gallium/auxiliary/indices/u_indices_gen.py | 25 +++----------------------
 1 file changed, 3 insertions(+), 22 deletions(-)

diff --git a/src/gallium/auxiliary/indices/u_indices_gen.py b/src/gallium/auxiliary/indices/u_indices_gen.py
index ea53502f702..d392f5c65bd 100644
--- a/src/gallium/auxiliary/indices/u_indices_gen.py
+++ b/src/gallium/auxiliary/indices/u_indices_gen.py
@@ -298,28 +298,9 @@ def polygon(intype, outtype, inpv, outpv, pr):
     preamble(intype, outtype, inpv, outpv, pr, prim='polygon')
     print('  for (i = start, j = 0; j < out_nr; j+=3, i++) { ')
     if pr == PRENABLE:
-        print('restart:')
-        print('      if (i + 3 > in_nr) {')
-        print('         (out+j+0)[0] = restart_index;')
-        print('         (out+j+0)[1] = restart_index;')
-        print('         (out+j+0)[2] = restart_index;')
-        print('         continue;')
-        print('      }')
-        print('      if (in[i + 0] == restart_index) {')
-        print('         i += 1;')
-        print('         start = i;')
-        print('         goto restart;')
-        print('      }')
-        print('      if (in[i + 1] == restart_index) {')
-        print('         i += 2;')
-        print('         start = i;')
-        print('         goto restart;')
-        print('      }')
-        print('      if (in[i + 2] == restart_index) {')
-        print('         i += 3;')
-        print('         start = i;')
-        print('         goto restart;')
-        print('      }')
+        def close_func(index):
+            print('         start = i;')
+        prim_restart(3, 3, 1, close_func)
 
     if inpv == FIRST:
         do_tri( intype, outtype, 'out+j',  'start', 'i+1', 'i+2', inpv, outpv );



More information about the mesa-commit mailing list