From: José Fonseca Date: Thu, 25 Nov 2010 10:08:50 +0000 (+0000) Subject: Try to handle arbitrary sizes better. X-Git-Url: https://git.cworth.org/git?p=apitrace;a=commitdiff_plain;h=5e254cabb2893d44009fc900e8677c17ce958587 Try to handle arbitrary sizes better. --- diff --git a/glapi.py b/glapi.py index 0b37d3c..219ae94 100644 --- a/glapi.py +++ b/glapi.py @@ -3635,6 +3635,7 @@ glapi.add_functions([ GlFunction(Void, "glGetProgramNamedParameterfvNV", [(GLprogram, "id"), (GLsizei, "len"), (Const(OpaquePointer(GLubyte)), "name"), (OpaquePointer(GLfloat), "params")], sideeffects=False), # GL_ATI_separate_stencil + GlFunction(Void, "glStencilOpSeparateATI", [(GLenum, "face"), (GLenum, "sfail"), (GLenum, "dpfail"), (GLenum, "dppass")]), GlFunction(Void, "glStencilFuncSeparateATI", [(GLenum, "frontfunc"), (GLenum, "backfunc"), (GLint, "ref"), (GLuint, "mask")]), # GL_EXT_depth_bounds_test @@ -3665,6 +3666,9 @@ glapi.add_functions([ # GL_EXT_framebuffer_blit GlFunction(Void, "glBlitFramebufferEXT", [(GLint, "srcX0"), (GLint, "srcY0"), (GLint, "srcX1"), (GLint, "srcY1"), (GLint, "dstX0"), (GLint, "dstY0"), (GLint, "dstX1"), (GLint, "dstY1"), (GLbitfield_attrib, "mask"), (GLenum, "filter")]), + # GL_EXT_framebuffer_multisample + GlFunction(Void, "glRenderbufferStorageMultisampleEXT", [(GLenum, "target"), (GLsizei, "samples"), (GLenum, "internalformat"), (GLsizei, "width"), (GLsizei, "height")]), + # GL_EXT_timer_query GlFunction(Void, "glGetQueryObjecti64vEXT", [(GLuint, "id"), (GLenum, "pname"), (OpaquePointer(GLint64EXT), "params")], sideeffects=False), GlFunction(Void, "glGetQueryObjectui64vEXT", [(GLuint, "id"), (GLenum, "pname"), (OpaquePointer(GLuint64EXT), "params")], sideeffects=False), diff --git a/helpers/spec.py b/helpers/spec.py index dd4a5ba..401c317 100755 --- a/helpers/spec.py +++ b/helpers/spec.py @@ -147,6 +147,11 @@ class SpecParser(LineParser): function_name, arg_names = mo.groups() arg_names = [arg_name.strip() for arg_name in arg_names.split(',') if arg_name.strip()] + extra = '' + if self.get_function_re.match(function_name): + extra += ', sideeffects=False' + function_name = self.prefix + function_name + ret_type = 'Void' arg_types = {} category = None @@ -157,7 +162,7 @@ class SpecParser(LineParser): ret_type = self.parse_type(fields[1]) elif fields[0] == 'param': arg_name, arg_type = fields[1:3] - arg_types[fields[1]] = self.parse_arg(arg_name, arg_type) + arg_types[fields[1]] = self.parse_arg(function_name, arg_name, arg_type) elif fields[0] == 'category': category = fields[1] else: @@ -182,10 +187,8 @@ class SpecParser(LineParser): constructor = 'StdFunction' else: constructor = 'GlFunction' - extra = '' - if self.get_function_re.match(function_name): - extra += ', sideeffects=False' - print ' %s(%s, "%s%s", [%s]%s),' % (constructor, ret_type, self.prefix, function_name, ', '.join(args), extra) + + print ' %s(%s, "%s", [%s]%s),' % (constructor, ret_type, function_name, ', '.join(args), extra) array_re = re.compile(r'^array\s+\[(.*)\]$') @@ -194,7 +197,7 @@ class SpecParser(LineParser): 'GLcharARB': 'GLstringARB', } - def parse_arg(self, arg_name, arg_type): + def parse_arg(self, function_name, arg_name, arg_type): orig_type, inout, kind = arg_type.split(' ', 2) base_type = self.parse_type(orig_type) @@ -219,9 +222,12 @@ class SpecParser(LineParser): elif length == '1': arg_type = 'Pointer(%s)' % base_type elif length.find("COMPSIZE") == -1: + arg_type = 'Array(%s, "%s")' % (base_type, length) + else: # XXX: Handle COMPSIZE better + length = length.replace("COMPSIZE", "__%s_size" % function_name) + length = length.replace("/", ",") arg_type = 'Array(%s, "%s")' % (base_type, length) - if inout == 'in': arg_type = 'Const(%s)' % arg_type else: