From 5a854b1216b5e3ae16ce20ac965bae42d0683c2c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Thu, 31 Mar 2011 10:35:29 +0100 Subject: [PATCH] Dump glGetString state too. --- glstate.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/glstate.py b/glstate.py index 387a720..0b5e1a1 100644 --- a/glstate.py +++ b/glstate.py @@ -35,6 +35,7 @@ I = Int E = GLenum F = Float P = OpaquePointer(Void) +S = String # TODO: This table and the one on glenum.py should be unified parameters = [ @@ -434,10 +435,10 @@ parameters = [ (X, 1, "GL_REPLACE"), # 0x1E01 (X, 1, "GL_INCR"), # 0x1E02 (X, 1, "GL_DECR"), # 0x1E03 - (X, 1, "GL_VENDOR"), # 0x1F00 - (X, 1, "GL_RENDERER"), # 0x1F01 - (X, 1, "GL_VERSION"), # 0x1F02 - (X, 1, "GL_EXTENSIONS"), # 0x1F03 + (S, 1, "GL_VENDOR"), # 0x1F00 + (S, 1, "GL_RENDERER"), # 0x1F01 + (S, 1, "GL_VERSION"), # 0x1F02 + (S, 1, "GL_EXTENSIONS"), # 0x1F03 (X, 1, "GL_S"), # 0x2000 (X, 1, "GL_T"), # 0x2001 (X, 1, "GL_R"), # 0x2002 @@ -2889,6 +2890,7 @@ class StateDumper: print def dump_parameters(self): + print ' const GLubyte * sparams[1];' print ' GLboolean bparams[16];' print ' GLint iparams[16];' print ' GLfloat fparams[16];' @@ -2918,10 +2920,18 @@ class StateDumper: buf = 'pparams' getter = 'glGetPointerv' writer = 'json.writeNumber((size_t)%s)' + elif type is S: + buf = 'sparams' + getter = 'glGetString' + writer = 'json.writeString((const char *)%s)' else: raise NotImplementedError print ' memset(%s, 0, %u * sizeof *%s);' % (buf, count, buf) - print ' %s(%s, %s);' % (getter, name, buf) + if getter.endswith('v'): + print ' %s(%s, %s);' % (getter, name, buf) + else: + assert count == 1 + print ' %s[0] = %s(%s);' % (buf, getter, name) print ' if (glGetError() != GL_NO_ERROR) {' #print ' std::cerr << "warning: %s(%s) failed\\n";' % (getter, name) print ' } else {' -- 2.45.2