Mesa (master): gallium/indices: implement prim-restart for line-loops
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 18 12:28:43 UTC 2020
Module: Mesa
Branch: master
Commit: 3aa4f64e8d50dcfced6b963bce7a7a28a0b7cff8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3aa4f64e8d50dcfced6b963bce7a7a28a0b7cff8
Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date: Mon Jun 22 18:38:03 2020 +0200
gallium/indices: implement prim-restart for line-loops
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 | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/gallium/auxiliary/indices/u_indices_gen.py b/src/gallium/auxiliary/indices/u_indices_gen.py
index e2177c31614..ea53502f702 100644
--- a/src/gallium/auxiliary/indices/u_indices_gen.py
+++ b/src/gallium/auxiliary/indices/u_indices_gen.py
@@ -208,7 +208,7 @@ def preamble(intype, outtype, inpv, outpv, pr, prim):
def postamble():
print('}')
-def prim_restart(in_verts, out_verts, out_prims):
+def prim_restart(in_verts, out_verts, out_prims, close_func = None):
print('restart:')
print(' if (i + ' + str(in_verts) + ' > in_nr) {')
for i in range(out_prims):
@@ -219,6 +219,10 @@ def prim_restart(in_verts, out_verts, out_prims):
for i in range(in_verts):
print(' if (in[i + ' + str(i) + '] == restart_index) {')
print(' i += ' + str(i + 1) + ';')
+
+ if close_func is not None:
+ close_func(i)
+
print(' goto restart;')
print(' }')
@@ -245,10 +249,21 @@ def linestrip(intype, outtype, inpv, outpv, pr):
def lineloop(intype, outtype, inpv, outpv, pr):
preamble(intype, outtype, inpv, outpv, pr, prim='lineloop')
+ print(' unsigned end = start;')
print(' for (i = start, j = 0; j < out_nr - 2; j+=2, i++) { ')
+ if pr == PRENABLE:
+ def close_func(index):
+ do_line( intype, outtype, 'out+j', 'end', 'start', inpv, outpv )
+ print(' start = i;')
+ print(' end = start;')
+ print(' j += 2;')
+
+ prim_restart(2, 2, 1, close_func)
+
do_line( intype, outtype, 'out+j', 'i', 'i+1', inpv, outpv );
+ print(' end = i+1;')
print(' }')
- do_line( intype, outtype, 'out+j', 'i', 'start', inpv, outpv );
+ do_line( intype, outtype, 'out+j', 'end', 'start', inpv, outpv );
postamble()
def tris(intype, outtype, inpv, outpv, pr):
More information about the mesa-commit
mailing list