aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mapi/glapi/gen/gl_enums.py
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-01-21 08:10:52 +0000
committermarha <marha@users.sourceforge.net>2011-01-21 08:10:52 +0000
commitb0be6a88c8fecdf15176f642c0799bff99930e0d (patch)
treeec9fea5c77c9d705757c0533beb059c467a16393 /mesalib/src/mapi/glapi/gen/gl_enums.py
parentb582c2f2afd66e3afa0d143923e8b71985e39a6c (diff)
downloadvcxsrv-b0be6a88c8fecdf15176f642c0799bff99930e0d.tar.gz
vcxsrv-b0be6a88c8fecdf15176f642c0799bff99930e0d.tar.bz2
vcxsrv-b0be6a88c8fecdf15176f642c0799bff99930e0d.zip
xserver mesa xkbcomp libxcb git update 21 jan 2011
Diffstat (limited to 'mesalib/src/mapi/glapi/gen/gl_enums.py')
-rw-r--r--mesalib/src/mapi/glapi/gen/gl_enums.py43
1 files changed, 27 insertions, 16 deletions
diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py
index 0caa01030..d51b74a4a 100644
--- a/mesalib/src/mapi/glapi/gen/gl_enums.py
+++ b/mesalib/src/mapi/glapi/gen/gl_enums.py
@@ -46,6 +46,7 @@ class PrintGlEnums(gl_XML.gl_print_base):
print '#include "main/mfeatures.h"'
print '#include "main/enums.h"'
print '#include "main/imports.h"'
+ print '#include "main/mtypes.h"'
print ''
print 'typedef struct {'
print ' size_t offset;'
@@ -111,29 +112,39 @@ const char *_mesa_lookup_enum_by_nr( int nr )
}
}
+/**
+ * Primitive names
+ */
+static const char *prim_names[PRIM_UNKNOWN + 1] = {
+ "GL_POINTS",
+ "GL_LINES",
+ "GL_LINE_LOOP",
+ "GL_LINE_STRIP",
+ "GL_TRIANGLES",
+ "GL_TRIANGLE_STRIP",
+ "GL_TRIANGLE_FAN",
+ "GL_QUADS",
+ "GL_QUAD_STRIP",
+ "GL_POLYGON",
+ "outside begin/end",
+ "inside unknown primitive",
+ "unknown state"
+};
+
+
/* 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 )
+const char *
+_mesa_lookup_prim_by_nr(GLuint 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 "<invalid>";
- }
+ if (nr < Elements(prim_names))
+ return prim_names[nr];
+ else
+ return "invalid mode";
}
-
int _mesa_lookup_enum_by_name( const char *symbol )
{
enum_elt * f = NULL;