summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/enums.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-01-20 09:38:49 -0700
committerBrian Paul <[email protected]>2011-01-20 09:44:33 -0700
commit887d2b647bae7f6536bab08649bad9f799995d08 (patch)
tree9c672fa057c8a150e7814279bac29413e3ae53e2 /src/mesa/main/enums.c
parentfe49dcb3b03454ec1451b610ea89f2374946e090 (diff)
mesa: clean-up _mesa_lookup_prim_by_nr()
Remove the redundant public _mesa_prim_name[] array.
Diffstat (limited to 'src/mesa/main/enums.c')
-rw-r--r--src/mesa/main/enums.c43
1 files changed, 27 insertions, 16 deletions
diff --git a/src/mesa/main/enums.c b/src/mesa/main/enums.c
index c358fb246bc..e9d6b6b156c 100644
--- a/src/mesa/main/enums.c
+++ b/src/mesa/main/enums.c
@@ -29,6 +29,7 @@
#include "main/mfeatures.h"
#include "main/enums.h"
#include "main/imports.h"
+#include "main/mtypes.h"
typedef struct {
size_t offset;
@@ -6243,29 +6244,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;