]> git.tdb.fi Git - gldbg.git/commitdiff
Allow tagging funtions for handcoding in templates
authorMikko Rasa <tdb@tdb.fi>
Wed, 28 Oct 2009 07:48:50 +0000 (07:48 +0000)
committerMikko Rasa <tdb@tdb.fi>
Wed, 28 Oct 2009 07:48:50 +0000 (07:48 +0000)
Send glGetError and glXGetProcAddress calls
Various string handling fixes
A couple other bugfixes

genwrap.py
gl.files
gl.tm
glx.files
glx.io
glx.tm
source/glprint.c
source/glwrap.c
source/glwrap.funcs.t

index ec239853875a386fdca9a4961b733a77622177c5..e614ab71ac34f2c237ad4f1571572490577ba602 100755 (executable)
@@ -138,8 +138,6 @@ class Function:
                                        self.csize = "%d*sizeof(%s)"%(self.size, self.base_ctype)
                                elif self.size.startswith("COMPSIZE("):
                                        self.csize = self.func.compsize(self.size[9:-1], self.base_ctype)
-                               elif self.size=="" and (self.type=="charARB" or self.type=="Char"):
-                                       self.csize = "strlen"
                                else:
                                        s = self.func.get_param(self.size.split('*')[0])
                                        if (s.type=="SizeI" or s.type.endswith("Int32") or s.type.startswith("BufferSize")) and s.kind=="value":
@@ -197,7 +195,7 @@ class Function:
                                sys.stderr.write("Compsize '%s' for function '%s' failed: Parameter '%s' has unknown type '%s'\n"%(size, self.name, param.name, param.type))
                                return
                if not have_type:
-                       res += "*sizeof(%s)"%param.ctype
+                       res += "*sizeof(%s)"%btype
                return res
 
        def finalize(self):
@@ -211,6 +209,7 @@ class Function:
 class Template:
        def __init__(self, fn):
                self.sections = []
+               self.handcode = []
 
                literal = True
                text = ""
@@ -221,6 +220,10 @@ class Template:
                                        text = ""
                                text += line[1:]+"\n"
                                literal = True
+                       elif line[0]=='!':
+                               parts = line[1:].split()
+                               if parts[0]=="handcode":
+                                       self.handcode.append(parts[1])
                        else:
                                if literal and text:
                                        self.add_section(text, literal)
@@ -248,6 +251,8 @@ class Template:
                                print sect
                        else:
                                for func in functions:
+                                       if func.name in self.handcode:
+                                               continue
                                        globals = {
                                                "w": self.write,
                                                "wl": self.writeln,
index d6631d845a3adcf2c634d9d4b39ed3131c2e0334..8be2a33866a68da9d1ebfa6cbe1dd65a565c62ab 100644 (file)
--- a/gl.files
+++ b/gl.files
@@ -4,4 +4,3 @@ spec gl.spec
 prefix gl
 ignore category VERSION_3_2
 ignore category ARB_sync
-ignore function glGetError
diff --git a/gl.tm b/gl.tm
index fb4f8515cddcda33c1491fd22b1abb5d0386b1b9..bc05d5fc08b8a90d7c13a985c462d4444fa7e4d8 100644 (file)
--- a/gl.tm
+++ b/gl.tm
@@ -10,7 +10,7 @@ BlendingFactorDest,*,*,                   GLenum,*,*
 BlendingFactorSrc,*,*,             GLenum,*,*
 Boolean,*,*,                       GLboolean,*,*
 BooleanPointer,*,*,                GLboolean*,*,*
-Char,*,*,                          GLchar,*,*
+Char,*,array,                      GLchar *,*,value
 CharPointer,*,*,                   GLchar*,*,*
 CheckedFloat32,*,*,                GLfloat,*,*
 CheckedInt32,*,*,                  GLint,*,*
@@ -290,7 +290,7 @@ Int64,*,*,                      GLint64,*,*
 UInt64,*,*,                        GLuint64,*,*
 # Object handle & data pointers
 handleARB,*,*,                     GLhandleARB,*,*
-charARB,*,*,                       GLcharARB,*,*
+charARB,*,array,                   GLcharARB *,*,value
 charPointerARB,*,*,                GLcharARB*,*,*
 sync,*,*,                          GLsync,*,*,
 # EXT_timer_query
index 3d7d138f85a9a44f9705889ed5b2d8ef75cf6a92..bfac81e0c29fab021563187c0d5e9b68304850d1 100644 (file)
--- a/glx.files
+++ b/glx.files
@@ -9,5 +9,3 @@ ignore category SGIX_dmbuffer
 ignore category SGIX_hyperpipe
 ignore category NV_video_output
 ignore category NV_video_capture
-ignore function glXGetProcAddress
-ignore function glXGetProcAddressARB
diff --git a/glx.io b/glx.io
index 7322c3a8fbe608299c0580736b7f67f14a7b2021..e30ff09d52501348d65da32e6f7465c02f73b8ff 100644 (file)
--- a/glx.io
+++ b/glx.io
@@ -9,6 +9,7 @@ sizei, int, %i
 float, float, %g
 unsigned int *, pointer, %p
 char *, string, \"%s\"
+ubyte *, string, \"%s\"
 Bool, int, %i
 Display *, pointer, %p
 XVisualInfo *, pointer, %p
@@ -25,3 +26,4 @@ GLXDrawable, long, %#lx
 GLXPbuffer, long, %#lx
 GLXWindow, long, %#lx
 GLXPixmap, long, %#lx
+__GLXextFuncPtr, pointer, %p
diff --git a/glx.tm b/glx.tm
index 7ba7c612b0f3305080de64b170962f20887464fe..0a865bdd5811c9036efaac2afaf7a19f9e45edd5 100644 (file)
--- a/glx.tm
+++ b/glx.tm
@@ -30,7 +30,7 @@ GLenum,*,*,               GLenum,*,*
 GLfunction,*,*,                    GLfunction,*,*
 GLint,*,*,                 GLint,*,*
 GLsizei,*,*,               GLsizei,*,*
-GLubyte,*,*,               GLubyte,*,*
+GLubyte,*,reference,               GLubyte *,*,value
 GLuint,*,*,                GLuint,*,*
 Pixmap,*,*,                Pixmap,*,*
 Status,*,*,                Status,*,*
index fbf6e0e07e35bceb47ecc824bb4552f25feb6d95..ec8d47e5f007c0a9b5ba4a61fd77dedad556314b 100644 (file)
@@ -40,6 +40,8 @@ GlDecoder *glprint_new(char *buffer, unsigned bufsize)
 
        init_print(dec);
        dec->gldError = print_gldError;
+
+       return dec;
 }
 
 char *glprint_get_buffer(GlDecoder *dec)
index 0a22c3c1ce4b6677c0bb66cdb10d559294fbe160..0673b5ae106407860c7cfaafcee6b07dc76034f1 100644 (file)
@@ -262,13 +262,21 @@ GLenum APIENTRY glGetError()
 {
        GLenum ret = cur_error;
        cur_error = GL_NO_ERROR;
+       begin_packet(FUNC_GLGETERROR);
+       write_int(ret);
+       send_packet();
        return ret;
 }
 
 void (*glXGetProcAddress(const GLubyte *procname))(void)
 {
        void *handle = dlopen(NULL, RTLD_LAZY);
-       return dlsym(handle, (const char *)procname);
+       void (*ret)() = dlsym(handle, (const char *)procname);
+       begin_packet(FUNC_GLXGETPROCADDRESS);
+       write_pointer(ret);
+       write_string(procname);
+       send_packet();
+       return ret;
 }
 
 void (*glXGetProcAddressARB(const GLubyte *))(void) __attribute__((alias("glXGetProcAddress")));
index a58a1c5288f96a01018c282280e02d052d6eab9f..59bdb47b216e5e71506731bb4c0d2c0b63b2c8ae 100644 (file)
@@ -1,4 +1,7 @@
 # $Id$
+!handcode glGetError
+!handcode glXGetProcAddress
+!handcode glXGetProcAddressARB
 wl('%s APIENTRY %s(%s)', ret.ctype, func.name, ", ".join([p.ctype+" "+p.name for p in params]))
 wl('{')
 wl('   static %s (*orig)(%s);', ret.ctype, ", ".join([p.ctype for p in params]))