X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fglapi%2Fgl_enums.py;h=27ab119537ec3dc9a8f81ab5a69de6614d388caf;hb=3083ba38f4c884b32cd0460607b5064b6b7008d2;hp=67fec7968a97d56b8900cf0dbc01321f771184c6;hpb=8abc860bd46a6cd584f9a64cb4613be76f82db06;p=mesa.git diff --git a/src/mesa/glapi/gl_enums.py b/src/mesa/glapi/gl_enums.py index 67fec7968a9..27ab119537e 100644 --- a/src/mesa/glapi/gl_enums.py +++ b/src/mesa/glapi/gl_enums.py @@ -43,6 +43,7 @@ class PrintGlEnums(gl_XML.gl_print_base): def printRealHeader(self): print '#include "glheader.h"' + print '#include "mfeatures.h"' print '#include "enums.h"' print '#include "imports.h"' print '' @@ -55,8 +56,6 @@ class PrintGlEnums(gl_XML.gl_print_base): def print_code(self): print """ -#define Elements(x) sizeof(x)/sizeof(*x) - typedef int (*cfunc)(const void *, const void *); /** @@ -111,6 +110,29 @@ const char *_mesa_lookup_enum_by_nr( int nr ) } } +/* Get the name of an enum given that it is a primitive type. Avoids + * GL_FALSE/GL_POINTS ambiguity and others. + */ +const char *_mesa_lookup_prim_by_nr( int nr ) +{ + switch (nr) { + case GL_POINTS: return "GL_POINTS"; + case GL_LINES: return "GL_LINES"; + case GL_LINE_STRIP: return "GL_LINE_STRIP"; + case GL_LINE_LOOP: return "GL_LINE_LOOP"; + case GL_TRIANGLES: return "GL_TRIANGLES"; + case GL_TRIANGLE_STRIP: return "GL_TRIANGLE_STRIP"; + case GL_TRIANGLE_FAN: return "GL_TRIANGLE_FAN"; + case GL_QUADS: return "GL_QUADS"; + case GL_QUAD_STRIP: return "GL_QUAD_STRIP"; + case GL_POLYGON: return "GL_POLYGON"; + case GL_POLYGON+1: return "OUTSIDE_BEGIN_END"; + default: return ""; + } +} + + + int _mesa_lookup_enum_by_name( const char *symbol ) { enum_elt * f = NULL;