[Piglit] [PATCH 1/4] shader_runner: Re-use struct string_to_enum for enable_table.
Paul Berry
stereotype441 at gmail.com
Tue Oct 1 12:32:39 PDT 2013
---
tests/shaders/shader_runner.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 463eddc..51358b4 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -76,6 +76,11 @@ struct component_version {
char _string[100];
};
+struct string_to_enum {
+ const char *name;
+ GLenum token;
+};
+
extern float piglit_tolerance[4];
static struct component_version gl_version;
@@ -1377,10 +1382,7 @@ set_parameter(const char *line)
}
}
-struct enable_table {
- const char *name;
- GLenum value;
-} enable_table[] = {
+struct string_to_enum enable_table[] = {
{ "GL_CLIP_PLANE0", GL_CLIP_PLANE0 },
{ "GL_CLIP_PLANE1", GL_CLIP_PLANE1 },
{ "GL_CLIP_PLANE2", GL_CLIP_PLANE2 },
@@ -1404,9 +1406,9 @@ do_enable_disable(const char *line, bool enable_flag)
for (i = 0; enable_table[i].name; ++i) {
if (0 == strcmp(name, enable_table[i].name)) {
if (enable_flag) {
- glEnable(enable_table[i].value);
+ glEnable(enable_table[i].token);
} else {
- glDisable(enable_table[i].value);
+ glDisable(enable_table[i].token);
}
return;
}
@@ -1449,11 +1451,6 @@ draw_instanced_rect(int primcount, float x, float y, float w, float h)
}
-struct string_to_enum {
- const char *name;
- GLenum token;
-};
-
GLenum
decode_drawing_mode(const char *mode_str)
{
--
1.8.4
More information about the Piglit
mailing list