summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Bieler <fabianbieler@fastmail.fm>2017-12-21 11:55:55 +0100
committerFabian Bieler <fabianbieler@fastmail.fm>2018-01-03 22:40:52 +0100
commit4f4441a412469299aab72355f3a3a42450c18280 (patch)
tree8ecac4ec1ba47094c1d896e97b1a2553acb30428
parent1e771fe0c12ba90fe60d4a905be7be2fc6897da9 (diff)
clipflat: Remove GLenum string literals.
Replace GLenum string literals with calls to piglit_get_gl_enum_name and piglit_get_prim_name. Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--tests/general/clipflat.c54
1 files changed, 12 insertions, 42 deletions
diff --git a/tests/general/clipflat.c b/tests/general/clipflat.c
index 2608d28a3..0493cc43f 100644
--- a/tests/general/clipflat.c
+++ b/tests/general/clipflat.c
@@ -367,36 +367,15 @@ calcQuadrant(GLfloat x, GLfloat y)
static void
-reportSubtest(GLenum mode, int drawMode, GLuint facing,
- GLuint fill,
+reportSubtest(GLenum mode, int drawMode,
+ const GLenum order, const GLenum poly_mode,
const GLfloat badColor[3], GLfloat x, GLfloat y,
bool pass)
{
const char *m, *d, *f, *p;
char *q;
- switch (mode) {
- case GL_TRIANGLES:
- m = "GL_TRIANGLES";
- break;
- case GL_TRIANGLE_STRIP:
- m = "GL_TRIANGLE_STRIP";
- break;
- case GL_TRIANGLE_FAN:
- m = "GL_TRIANGLE_FAN";
- break;
- case GL_QUADS:
- m = "GL_QUADS";
- break;
- case GL_QUAD_STRIP:
- m = "GL_QUAD_STRIP";
- break;
- case GL_POLYGON:
- m = "GL_POLYGON";
- break;
- default:
- m = "???";
- }
+ m = piglit_get_prim_name(mode);
switch (drawMode) {
case BEGIN_END:
@@ -413,15 +392,9 @@ reportSubtest(GLenum mode, int drawMode, GLuint facing,
d = "???";
}
- if (facing == 0)
- f = "GL_CCW";
- else
- f = "GL_CW";
+ f = piglit_get_gl_enum_name(order);
- if (fill == 0)
- p = "GL_FILL";
- else
- p = "GL_LINE";
+ p = piglit_get_gl_enum_name(poly_mode);
q = calcQuadrant(x, y);
@@ -457,17 +430,14 @@ testPrimCombo(GLenum mode, const GLfloat *verts, GLuint count,
{
GLfloat x, y;
bool pass = true;
+ const GLenum poly_mode = fill ? GL_LINE : GL_FILL;
+ const GLenum order = facing ? GL_CW : GL_CCW;
+ const GLenum cull_face = facing ? GL_FRONT : GL_BACK;
- glPolygonMode(GL_FRONT_AND_BACK, fill ? GL_LINE : GL_FILL);
+ glPolygonMode(GL_FRONT_AND_BACK, poly_mode);
- if (facing == 0) {
- glFrontFace(GL_CCW);
- glCullFace(GL_BACK);
- }
- else {
- glFrontFace(GL_CW);
- glCullFace(GL_FRONT);
- }
+ glFrontFace(order);
+ glCullFace(cull_face);
// Position the geometry at 9 different locations to test
// clipping against the left, right, bottom and top edges of
@@ -501,7 +471,7 @@ testPrimCombo(GLenum mode, const GLfloat *verts, GLuint count,
quad_pass = checkResult(badColor);
pass = pass && quad_pass;
- reportSubtest(mode, drawMode, facing, fill,
+ reportSubtest(mode, drawMode, order, poly_mode,
badColor, x, y, quad_pass);
}
}