[Piglit] [PATCH 3/4] shader_runner: Add the ability to set hints.

Paul Berry stereotype441 at gmail.com
Tue Oct 1 12:32:41 PDT 2013


---
 tests/shaders/shader_runner.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index 8e72fdf..a28e8a8 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -1426,6 +1426,29 @@ do_enable_disable(const char *line, bool enable_flag)
 		glDisable(value);
 }
 
+struct string_to_enum hint_target_table[] = {
+	{ "GL_LINE_SMOOTH_HINT", GL_LINE_SMOOTH_HINT },
+	{ "GL_POLYGON_SMOOTH_HINT", GL_POLYGON_SMOOTH_HINT },
+	{ "GL_TEXTURE_COMPRESSION_HINT", GL_TEXTURE_COMPRESSION_HINT },
+	{ "GL_FRAGMENT_SHADER_DERIVATIVE_HINT",
+	  GL_FRAGMENT_SHADER_DERIVATIVE_HINT },
+};
+
+struct string_to_enum hint_param_table[] = {
+	{ "GL_FASTEST", GL_FASTEST },
+	{ "GL_NICEST", GL_NICEST },
+	{ "GL_DONT_CARE", GL_DONT_CARE },
+};
+
+void do_hint(const char *line)
+{
+	GLenum target = lookup_enum_string(hint_target_table, &line,
+					   "hint target");
+	GLenum param = lookup_enum_string(hint_param_table, &line,
+					  "hint param");
+	glHint(target, param);
+}
+
 static void
 draw_instanced_rect(int primcount, float x, float y, float w, float h)
 {
@@ -1696,6 +1719,8 @@ piglit_display(void)
 			get_floats(line + 7, c, 6);
 			piglit_frustum_projection(false, c[0], c[1], c[2],
 						  c[3], c[4], c[5]);
+		} else if (string_match("hint", line)) {
+			do_hint(line + 4);
 		} else if (sscanf(line, "ortho %f %f %f %f",
 				  c + 0, c + 1, c + 2, c + 3) == 4) {
 			piglit_gen_ortho_projection(c[0], c[1], c[2], c[3],
-- 
1.8.4



More information about the Piglit mailing list