From 77c10d8849459dbf7484fbc75eabe26cb401bb5a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 20 Jul 2013 15:27:29 +0100 Subject: [PATCH] cgltrace: Fix CGLChoosePixelFormat prototype. And implify AttribList in the process. --- specs/eglapi.py | 8 ++++---- specs/stdapi.py | 7 ++----- specs/wglapi.py | 2 +- wrappers/trace.py | 6 +++--- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/specs/eglapi.py b/specs/eglapi.py index 569481b..c4db7da 100644 --- a/specs/eglapi.py +++ b/specs/eglapi.py @@ -88,7 +88,7 @@ EGLSurfaceFlags = Flags(Int, [ EGLConformantFlags = Flags(Int, ['EGL_OPENGL_BIT','EGL_OPENGL_ES_BIT', 'EGL_OPENGL_ES2_BIT', 'EGL_OPENVG_BIT',]) -EGLConfigAttribs = AttribArray(EGLenum, [ +EGLConfigAttribs = AttribArray(EGLint_enum, [ ('EGL_ALPHA_MASK_SIZE', UInt), ('EGL_ALPHA_SIZE', UInt), ('EGL_BIND_TO_TEXTURE_RGB', EGLBoolean), @@ -125,7 +125,7 @@ EGLTextureFormat = FakeEnum(Int, ['EGL_NO_TEXTURE', 'EGL_TEXTURE_RGB', 'EGL_TEXT EGLTextureTarget = FakeEnum(Int, ['EGL_TEXTURE_2D', 'EGL_NO_TEXTURE' ]) def EGLAttribArray(values): - return AttribArray(EGLenum, values, terminator = 'EGL_NONE') + return AttribArray(EGLint_enum, values, terminator = 'EGL_NONE') EGLWindowsSurfaceAttribs = EGLAttribArray([ ('EGL_RENDER_BUFFER', FakeEnum(Int, ['EGL_SINGLE_BUFFER', 'EGL_BACK_BUFFER'])), @@ -209,7 +209,7 @@ eglapi.addFunctions([ Function(EGLBoolean, "eglSwapInterval", [(EGLDisplay, "dpy"), (EGLint, "interval")]), - Function(EGLContext, "eglCreateContext", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLContext, "share_context"), (AttribArray(EGLenum, [('EGL_CONTEXT_CLIENT_VERSION', Int)]), "attrib_list")]), + Function(EGLContext, "eglCreateContext", [(EGLDisplay, "dpy"), (EGLConfig, "config"), (EGLContext, "share_context"), (AttribArray(EGLint_enum, [('EGL_CONTEXT_CLIENT_VERSION', Int)]), "attrib_list")]), Function(EGLBoolean, "eglDestroyContext", [(EGLDisplay, "dpy"), (EGLContext, "ctx")]), Function(EGLBoolean, "eglMakeCurrent", [(EGLDisplay, "dpy"), (EGLSurface, "draw"), (EGLSurface, "read"), (EGLContext, "ctx")]), @@ -232,7 +232,7 @@ eglapi.addFunctions([ Function(EGLBoolean, "eglUnlockSurfaceKHR", [(EGLDisplay, "display"), (EGLSurface, "surface")]), # EGL_KHR_image_base - Function(EGLImageKHR, "eglCreateImageKHR", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLenum, "target"), (EGLClientBuffer, "buffer"), (AttribArray(EGLenum, [('EGL_IMAGE_PRESERVED_KHR', EGLBoolean)]), "attrib_list")]), + Function(EGLImageKHR, "eglCreateImageKHR", [(EGLDisplay, "dpy"), (EGLContext, "ctx"), (EGLenum, "target"), (EGLClientBuffer, "buffer"), (AttribArray(EGLint_enum, [('EGL_IMAGE_PRESERVED_KHR', EGLBoolean)]), "attrib_list")]), Function(EGLBoolean, "eglDestroyImageKHR", [(EGLDisplay, "dpy"), (EGLImageKHR, "image")]), # EGL_KHR_fence_sync diff --git a/specs/stdapi.py b/specs/stdapi.py index 5cf1a37..1988c65 100644 --- a/specs/stdapi.py +++ b/specs/stdapi.py @@ -272,15 +272,12 @@ class Array(Type): class AttribArray(Type): - def __init__(self, keyType, valueTypes, isConst = True, punType = None, terminator = '0'): - self.baseType = Int - if punType is not None: - self.baseType = punType + def __init__(self, baseType, valueTypes, isConst = True, terminator = '0'): + self.baseType = baseType if isConst: Type.__init__(self, (Pointer(Const(self.baseType))).expr) else: Type.__init__(self, (Pointer(self.baseType)).expr) - self.keyType = keyType self.valueTypes = valueTypes self.terminator = terminator self.hasKeysWithoutValues = False diff --git a/specs/wglapi.py b/specs/wglapi.py index 32172a8..9c4b13b 100644 --- a/specs/wglapi.py +++ b/specs/wglapi.py @@ -188,7 +188,7 @@ WGLPixelFormatAttribsList = [ ] WGLPixelFormatAttribs = AttribArray(WGLenum, WGLPixelFormatAttribsList) -WGLPixelFormatFloatAttribs = AttribArray(WGLenum, WGLPixelFormatAttribsList, punType = FLOAT) +WGLPixelFormatFloatAttribs = AttribArray(FLOAT, WGLPixelFormatAttribsList) WGLCreatePbufferARBAttribs = AttribArray(WGLenum, [ ('WGL_PBUFFER_LARGEST_ARB', Int) diff --git a/wrappers/trace.py b/wrappers/trace.py index 70b5e95..4b25607 100644 --- a/wrappers/trace.py +++ b/wrappers/trace.py @@ -212,7 +212,7 @@ class ValueSerializer(stdapi.Visitor, stdapi.ExpanderMixin): # It is currently assumed that an unknown key means that it is followed by an int value. # determine the array length which must be passed to writeArray() up front - count = '_c' + array.keyType.tag + count = '_c' + array.baseType.tag print ' {' print ' int %s;' % count print ' for (%(c)s = 0; %(array)s && %(array)s[%(c)s] != %(terminator)s; %(c)s += 2) {' \ @@ -231,10 +231,10 @@ class ValueSerializer(stdapi.Visitor, stdapi.ExpanderMixin): # for each key / key-value pair write the key and the value, if the key requires one - index = '_i' + array.keyType.tag + index = '_i' + array.baseType.tag print ' for (int %(i)s = 0; %(i)s < %(count)s; %(i)s++) {' % {'i': index, 'count': count} print ' trace::localWriter.beginElement();' - self.visitEnum(array.keyType, "%(array)s[%(i)s]" % {'array': instance, 'i': index}) + self.visit(array.baseType, "%(array)s[%(i)s]" % {'array': instance, 'i': index}) print ' trace::localWriter.endElement();' print ' if (%(i)s + 1 >= %(count)s) {' % {'i': index, 'count': count} print ' break;' -- 2.43.0