util/indicies: use itertools.product in u_unfilled_gen.py
authorDylan Baker <dylan.c.baker@intel.com>
Wed, 12 Oct 2022 22:13:19 +0000 (15:13 -0700)
committerMarge Bot <emma+marge@anholt.net>
Wed, 19 Oct 2022 20:21:08 +0000 (20:21 +0000)
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19058>

src/util/indices/u_unfilled_gen.py

index 8cdf75d..9dc0a95 100644 (file)
@@ -24,6 +24,8 @@ copyright = '''
  */
 '''
 
+import itertools
+
 GENERATE, UBYTE, USHORT, UINT = 'generate', 'ubyte', 'ushort', 'uint'
 FIRST, LAST = 'first', 'last'
 
@@ -193,16 +195,15 @@ def tristripadj(intype, outtype):
 
 
 def emit_funcs():
-    for intype in INTYPES:
-        for outtype in OUTTYPES:
-            tris(intype, outtype)
-            tristrip(intype, outtype)
-            trifan(intype, outtype)
-            quads(intype, outtype)
-            quadstrip(intype, outtype)
-            polygon(intype, outtype)
-            trisadj(intype, outtype)
-            tristripadj(intype, outtype)
+    for intype, outtype in itertools.product(INTYPES, OUTTYPES):
+        tris(intype, outtype)
+        tristrip(intype, outtype)
+        trifan(intype, outtype)
+        quads(intype, outtype)
+        quadstrip(intype, outtype)
+        polygon(intype, outtype)
+        trisadj(intype, outtype)
+        tristripadj(intype, outtype)
 
 def init(intype, outtype, prim):
     if intype == GENERATE:
@@ -219,10 +220,8 @@ def init(intype, outtype, prim):
 
 
 def emit_all_inits():
-    for intype in INTYPES:
-        for outtype in OUTTYPES:
-            for prim in PRIMS:
-                init(intype, outtype, prim)
+    for intype, outtype, prim in itertools.product(INTYPES, OUTTYPES, PRIMS):
+        init(intype, outtype, prim)
 
 def emit_init():
     print('void u_unfilled_init( void )')