[Piglit] [PATCH 3/8] shader_runner: Add a command for drawing a rect using pixel coordinates.

Eric Anholt eric at anholt.net
Fri Aug 29 14:41:14 PDT 2014


This lets you specify pixel coordinates in your draw_rect like using
the ortho keyword, while avoiding use of the deprecated MVP.
---
 tests/shaders/shader_runner.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/shaders/shader_runner.c b/tests/shaders/shader_runner.c
index b2bde04..717be42 100644
--- a/tests/shaders/shader_runner.c
+++ b/tests/shaders/shader_runner.c
@@ -2047,6 +2047,14 @@ piglit_display(void)
 			get_floats(line + 13, c, 8);
 			piglit_draw_rect_tex(c[0], c[1], c[2], c[3],
 					     c[4], c[5], c[6], c[7]);
+		} else if (string_match("draw rect ortho", line)) {
+			program_must_be_in_use();
+			get_floats(line + 15, c, 4);
+
+			piglit_draw_rect(-1.0 + 2.0 * (c[0] / piglit_width),
+					 -1.0 + 2.0 * (c[1] / piglit_height),
+					 2.0 * (c[2] / piglit_width),
+					 2.0 * (c[3] / piglit_height));
 		} else if (string_match("draw rect", line)) {
 			program_must_be_in_use();
 			get_floats(line + 9, c, 4);
-- 
2.1.0



More information about the Piglit mailing list