api_hw_select_init_h.py: simplify the code
authorMarek Olšák <marek.olsak@amd.com>
Thu, 11 Aug 2022 15:04:13 +0000 (11:04 -0400)
committerMarge Bot <emma+marge@anholt.net>
Mon, 26 Sep 2022 22:58:16 +0000 (22:58 +0000)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18828>

src/mapi/glapi/gen/api_hw_select_init_h.py
src/mapi/glapi/gen/gl_XML.py

index 8d2e851..666580f 100644 (file)
 
 # This script generates the file api_hw_select_init.h.
 
-import argparse
-import collections
 import license
 import gl_XML
-import sys
 import apiexec
-import re
 
 
 class PrintCode(gl_XML.gl_print_base):
@@ -43,11 +39,9 @@ class PrintCode(gl_XML.gl_print_base):
 
     def printBody(self, api):
         for f in api.functionIterateAll():
-            if f.exec_flavor != 'beginend':
-                continue
-
-            if (re.match('Vertex*', f.name)):
+            if f.has_hw_select_variant:
                 print('SET_{0}(tab, NAME({0}));'.format(f.name))
 
+
 if __name__ == '__main__':
     apiexec.print_glapi_file(PrintCode())
index cafe087..d9e4d09 100644 (file)
@@ -615,6 +615,7 @@ class gl_function( gl_item ):
         self.initialized = 0
         self.images = []
         self.exec_flavor = 'mesa'
+        self.has_hw_select_variant = False
         self.desktop = True
         self.deprecated = None
         self.has_no_error_variant = False
@@ -693,6 +694,8 @@ class gl_function( gl_item ):
         else:
             true_name = name
 
+            self.has_hw_select_variant = exec_flavor == 'beginend' and name[0:6] == 'Vertex'
+
             # Only try to set the offset when a non-alias entry-point
             # is being processed.