]> git.tdb.fi Git - gldbg.git/commitdiff
Add an errata system to avoid the need of putting special cases in code
authorMikko Rasa <tdb@tdb.fi>
Sat, 25 Aug 2012 08:09:18 +0000 (11:09 +0300)
committerMikko Rasa <tdb@tdb.fi>
Sat, 25 Aug 2012 08:09:18 +0000 (11:09 +0300)
flavors/gl/gl.api
flavors/gl/gl.errata [new file with mode: 0644]
generate.py

index 40b44c769969d160b76b218051ec5dba395203a7..3ddc17fa288e54bd804260e48d9560a804e54fad 100644 (file)
@@ -1,6 +1,7 @@
 typemap gl.tm
 iomap gl.io
 spec gl.spec
+errata gl.errata
 prefix gl
 enumspec enum.spec
 enumprefix GL_
diff --git a/flavors/gl/gl.errata b/flavors/gl/gl.errata
new file mode 100644 (file)
index 0000000..b1681fc
--- /dev/null
@@ -0,0 +1,29 @@
+UniformMatrix2fv(...)
+       param  value  Float32 in array [count*4]
+
+UniformMatrix3fv(...)
+       param  value  Float32 in array [count*9]
+
+UniformMatrix4fv(...)
+       param  value  Float32 in array [count*16]
+
+Uniform2fv(...)
+       param  value  Float32 in array [count*2]
+
+Uniform3fv(...)
+       param  value  Float32 in array [count*3]
+
+Uniform4fv(...)
+       param  value  Float32 in array [count*4]
+
+Uniform2iv(...)
+       param  value  Int32 in array [count*2]
+
+Uniform3iv(...)
+       param  value  Int32 in array [count*3]
+
+Uniform4iv(...)
+       param  value  Int32 in array [count*4]
+
+GetActiveUniformsiv(...)
+       param  params  Int32 out array [COMPSIZE(pname/uniformCount)]
index 229ecc3ecf18b347256a7cded1653ee6c0de2215..3877e6d35cbcdda14396a8bf9b21d778caa23dbf 100755 (executable)
@@ -146,10 +146,6 @@ class Function:
                                        if (s.type=="SizeI" or s.type.endswith("Int32") or s.type.startswith("BufferSize")):
                                                if s.kind=="value":
                                                        self.csize = "%s"%self.size
-                                                       if self.func.name.startswith("glUniformMatrix") and self.func.name[16]!='x':
-                                                               self.csize += "*%d"%(int(self.func.name[15])**2)
-                                                       elif self.func.name.startswith("glUniform") and self.func.name[9].isdigit():
-                                                               self.csize += "*%s"%self.func.name[9]
                                                        if strip_name(self.base_ctype)!="void":
                                                                self.csize += "*sizeof(%s)"%self.base_ctype
                                                elif s.kind=="array" and s.size==1:
@@ -307,6 +303,8 @@ class Template:
                                iomap = IOmap(api.iomap)
                                for spec in api.specs:
                                        funcs = read_spec(spec, api.prefix)
+                                       for err in api.errata:
+                                               read_spec(err, api.prefix, funcs)
                                        funcs = [f for f in funcs if f.name not in api.ignore_funcs and f.category not in api.ignore_categs]
                                        for func in funcs:
                                                func.finalize(typemap, iomap)
@@ -328,6 +326,7 @@ class Api:
                self.typemap = None
                self.iomap = None
                self.specs = []
+               self.errata = []
                self.prefix = None
                self.enumspecs = []
                self.enumprefix = None
@@ -344,6 +343,8 @@ class Api:
                                self.iomap = os.path.join(path, parts[1])
                        elif parts[0]=="spec":
                                self.specs.append(os.path.join(path, parts[1]))
+                       elif parts[0]=="errata":
+                               self.errata.append(os.path.join(path, parts[1]))
                        elif parts[0]=="prefix":
                                self.prefix = parts[1]
                        elif parts[0]=="enumspec":
@@ -359,8 +360,9 @@ class Api:
                                sys.stderr.write("Unknown keyword '%s'\n", parts[0])
 
 
-def read_spec(fn, prefix):
-       funcs = []
+def read_spec(fn, prefix, funcs=None):
+       if funcs is None:
+               funcs = []
        cur_func = None
 
        for line in InputFile(fn):
@@ -392,8 +394,15 @@ def read_spec(fn, prefix):
                                        pnames = [n.strip() for n in line[paren+1:cparen].split(",")]
                                else:
                                        pnames = []
-                               cur_func = Function(prefix+line[:paren], pnames)
-                               funcs.append(cur_func)
+                               fname = prefix+line[:paren]
+                               cur_func = None
+                               for f in funcs:
+                                       if f.name==fname:
+                                               cur_func = f
+                                               break
+                               if not cur_func:
+                                       cur_func = Function(prefix+line[:paren], pnames)
+                                       funcs.append(cur_func)
 
        return funcs