From: Ian Romanick Date: Tue, 25 Jan 2005 01:20:11 +0000 (+0000) Subject: Add a "count" attribute to "enums" elements to set the default count X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=85f0fa3761f8673ef48e46e0670ac816a34f000a;p=mesa.git Add a "count" attribute to "enums" elements to set the default count used for "size" sub-elements. In the future the "count" attribute may be removed completely from "size" sub-elements, so gl_API.xml was also updated. Support was added for a (currently unused) "mode" attribute for "size" elements. Basically, functions are marked as either "get" or "set". This will be used in generating size functions for the server-side (where the "get" functions have to know how much data to return). It could also be used to help generate code for src/mesa/main/get.c. --- diff --git a/src/mesa/glapi/glX_XML.py b/src/mesa/glapi/glX_XML.py index 4c9da6e304d..9d8fe000961 100644 --- a/src/mesa/glapi/glX_XML.py +++ b/src/mesa/glapi/glX_XML.py @@ -244,7 +244,7 @@ class glXEnum(gl_XML.glEnum): def startElement(self, name, attrs): if name == "size": - [n, c] = self.process_attributes(attrs) + [n, c, mode] = self.process_attributes(attrs) if not self.context.glx_enum_functions.has_key( n ): f = glXEnumFunction( n ) diff --git a/src/mesa/glapi/gl_API.xml b/src/mesa/glapi/gl_API.xml index 367c63ca66c..94cc4fb80f9 100644 --- a/src/mesa/glapi/gl_API.xml +++ b/src/mesa/glapi/gl_API.xml @@ -229,46 +229,46 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -372,9 +372,9 @@ glx: - - - + + + @@ -405,77 +405,77 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -492,90 +492,90 @@ glx: - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + @@ -593,21 +593,21 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + @@ -649,32 +649,32 @@ glx: - - - + + + - - - + + + - - - - + + + + - - - - + + + + - - - - + + + + @@ -682,21 +682,21 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + @@ -2667,13 +2667,13 @@ glx: - - - + + + - - - + + + @@ -2949,9 +2949,9 @@ glx: - - - + + + @@ -2966,25 +2966,25 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -2997,45 +2997,45 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -3437,65 +3437,65 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + - - - + + + @@ -3800,21 +3800,21 @@ glx: - - + + - - + + - - + + - - + + - - - + + + @@ -3838,26 +3838,26 @@ glx: - - - - - + + + + + - - - + + + - - - + + + - - - + + + @@ -4701,17 +4701,17 @@ glx: - - + + - - + + - - + + - - + + @@ -4909,28 +4909,28 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + @@ -6064,9 +6064,9 @@ glx: - - - + + + @@ -6377,22 +6377,22 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + @@ -6781,27 +6781,27 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + @@ -6813,13 +6813,13 @@ glx: - - - + + + - - - + + + @@ -6869,17 +6869,17 @@ glx: - - + + - - + + - - + + - - + + @@ -6929,13 +6929,13 @@ glx: - - - + + + - - - + + + @@ -6992,9 +6992,9 @@ glx: - - - + + + @@ -7152,17 +7152,17 @@ glx: - - - + + + - - - + + + - - - + + + @@ -7174,9 +7174,9 @@ glx: - - - + + + @@ -7213,13 +7213,13 @@ glx: - - - + + + - - - + + + @@ -8223,16 +8223,16 @@ glx: - - - + + + - - - + + + @@ -8376,9 +8376,9 @@ glx: - - - + + + @@ -8386,21 +8386,21 @@ glx: - - - + + + - - - + + + - - - + + + - - - + + + @@ -9339,17 +9339,17 @@ glx: - - - + + + - - - + + + - - - + + + @@ -9508,22 +9508,22 @@ glx: - - + + - - + + - - + + - - + + - - - + + + @@ -9616,9 +9616,9 @@ glx: - - - + + + @@ -9675,17 +9675,17 @@ glx: - - + + - - + + - - + + - - + + diff --git a/src/mesa/glapi/gl_XML.py b/src/mesa/glapi/gl_XML.py index bc7d27befe3..61c9b355cf2 100644 --- a/src/mesa/glapi/gl_XML.py +++ b/src/mesa/glapi/gl_XML.py @@ -90,17 +90,40 @@ class glEnum( glItem ): enum_name = "GL_" + attrs.get('name', None) glItem.__init__(self, name, enum_name, context) + temp = attrs.get('count', None) + if temp == None: + self.default_count = 0 + else: + try: + c = int(temp) + except Exception,e: + raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp, self.name, n)) + + self.default_count = c + return + def process_attributes(self, attrs): name = attrs.get('name', None) temp = attrs.get('count', None) - try: - c = int(temp) - except Exception,e: - raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp, self.name, n)) + if temp == None: + c = self.default_count + else: + try: + c = int(temp) + except Exception,e: + raise RuntimeError('Invalid count value "%s" for enum "%s" in function "%s" when an integer was expected.' % (temp, self.name, n)) + + mode_str = attrs.get('mode', "set") + if mode_str == "set": + mode = 1 + elif mode_str == "get": + mode = 0 + else: + raise RuntimeError("Invalid mode '%s' for function '%s' in enum '%s'." % (mode_str, self.context.name, self.name)) - return [name, c] + return [name, c, mode] class glType( glItem ):