From e635951b05e1b0b0e5c972fcbaba691b86753d67 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 18 Jan 2011 08:19:31 +0000 Subject: [PATCH] Describe some texture parameters when printing Describe texture internal formats Fix GLES2 compilation --- flavors/gles2/egl.io | 4 ++-- flavors/gles2/gles2.io | 4 ++-- source/glprint.c | 31 +++++++++++++++++++++++++++++++ source/glprint.funcs.t | 16 ++++++++++++++-- 4 files changed, 49 insertions(+), 6 deletions(-) diff --git a/flavors/gles2/egl.io b/flavors/gles2/egl.io index 3f795dd..511bc33 100644 --- a/flavors/gles2/egl.io +++ b/flavors/gles2/egl.io @@ -7,8 +7,8 @@ EGLConfig, pointer, %p EGLSurface, pointer, %p EGLNativeWindowType, int, %lx EGLNativePixmapType, int, %lx -EGLenum, int, %s, describe_enum:p.name:'"%s"'%p.type -EGLenumHack, int, %s, describe_enum:p.name:'"%s"'%p.type +EGLenum, int, %s, describe_enum +EGLenumHack, int, %s, describe_enum EGLClientBuffer, pointer, %p EGLContext, pointer, %p __eglMustCastToProperFunctionPointerType, pointer, %p diff --git a/flavors/gles2/gles2.io b/flavors/gles2/gles2.io index f64dab6..983321e 100644 --- a/flavors/gles2/gles2.io +++ b/flavors/gles2/gles2.io @@ -1,6 +1,6 @@ -enum, int, %s, describe_enum:p.name:'"%s"'%p.type +enum, int, %s, describe_enum boolean, char, %i -bitfield, int, %s, describe_bitfield:p.name:'"%s"'%p.type +bitfield, int, %s, describe_bitfield byte, char, %i ubyte, char, %u short, short, %i diff --git a/source/glprint.c b/source/glprint.c index dff66f4..33d083d 100644 --- a/source/glprint.c +++ b/source/glprint.c @@ -155,6 +155,37 @@ static const char *print_array_described(const char *(*describe)(GLenum, const c return buffer; } +static const char *print_parameter(int pname, int param) +{ + char *buffer; + + // XXX Need to move the param names to flavor + switch(pname) + { + case GL_TEXTURE_MIN_FILTER: + case GL_TEXTURE_MAG_FILTER: + case GL_TEXTURE_WRAP_S: + case GL_TEXTURE_WRAP_T: + return describe_enum(param, ""); + } + + buffer = tmpalloc(11); + snprintf(buffer, 11, "%i", param); + return buffer; +} + +static const char *print_internal_format(int fmt) +{ + char *buffer; + + if(fmt>4) + return describe_enum(fmt, "PixelFormat"); + + buffer = tmpalloc(2); + snprintf(buffer, 2, "%i", fmt); + return buffer; +} + static const char *print_data(const void *data, unsigned size) { if(!data) diff --git a/source/glprint.funcs.t b/source/glprint.funcs.t index 5f703e1..b2fa119 100644 --- a/source/glprint.funcs.t +++ b/source/glprint.funcs.t @@ -9,11 +9,19 @@ wl('{') wl(' GlPrintData *gpd = (GlPrintData *)user_data;') w(' snprintf(gpd->buffer, gpd->bufsize, "%s(', func.name) first = True +pname = None for p in params: if not first: w(', ') + if p.name=="pname": + pname = p if p.kind=="value": - w('%s', p.io[1]) + if pname and p.name=="param" and p.base_ctype=="GLint": + w('%%s') + elif p.type=="TextureComponentCount": + w('%%s') + else: + w('%s', p.io[1]) elif p.kind=="reference" and not p.io: w('', p.type) else: @@ -26,7 +34,11 @@ w('"') for p in params+[ret]: if p.ctype!="void": if p.kind=="value": - if len(p.io)>=3 and p.io[2]: + if pname and p.name=="param" and p.base_ctype=="GLint": + w(', print_parameter(%s, %s)', pname.name, p.name) + elif p.type=="TextureComponentCount": + w(', print_internal_format(%s)', p.name) + elif len(p.io)>=3 and p.io[2]: w(', %s(%s, "%s")', p.io[2], p.name, p.type) else: w(', %s', p.name) -- 2.43.0