On 20 September 2011 14:51, Eric Anholt <span dir="ltr"><<a href="mailto:eric@anholt.net">eric@anholt.net</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
As fallout, test a couple more combinations.<br>
---<br>
tests/all.tests | 29 ++++++-----<br>
tests/spec/gl-2.0/vertex-program-two-side.c | 73 +++++++++++++--------------<br>
2 files changed, 50 insertions(+), 52 deletions(-)<br>
<br>
diff --git a/tests/all.tests b/tests/all.tests<br>
index 94b3184..5404880 100644<br>
--- a/tests/all.tests<br>
+++ b/tests/all.tests<br>
@@ -732,21 +732,22 @@ add_texwrap_test3(gl20, '2D', 'npot', 'proj')<br>
add_texwrap_test2(gl20, '3D', 'npot')<br>
add_texwrap_test3(gl20, '3D', 'npot', 'proj')<br>
add_plain_test(gl20, 'getattriblocation-conventional')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side enabled front back front2 back2')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side enabled front back')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side enabled front2 back2')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side enabled front front2')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side enabled back back2')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side enabled front')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side enabled back')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side enabled front2')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side enabled back2')<br>
+<br>
+add_concurrent_test(gl20, 'vertex-program-two-side front back front2 back2')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side front back')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side front2 back2')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side front front2')<br>
add_concurrent_test(gl20, 'vertex-program-two-side front')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side back')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side primary')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side primary front')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side primary back')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side secondary')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side secondary front')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side secondary back')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side disabled')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side disabled front')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side disabled primary')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side disabled primary front')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side disabled secondary')<br>
-add_concurrent_test(gl20, 'vertex-program-two-side disabled secondary front')<br>
+add_concurrent_test(gl20, 'vertex-program-two-side front2')<br></blockquote><div><br>There are a few nonsensical use cases that won't produce well-defined colors, but are probably worth testing just to make sure they don't cause a GPU hang or assertion failure, such as "enabled front back back2", or "back back2". In fact, I would argue that it's worth testing all 32 combinations of enable, front, back, front2, and back2 just to be on the safe side.<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
# Group spec/glsl-1.00<br>
spec['glsl-1.00'] = Group()<br>
diff --git a/tests/spec/gl-2.0/vertex-program-two-side.c b/tests/spec/gl-2.0/vertex-program-two-side.c<br>
index e57e508..611e1a9 100644<br>
--- a/tests/spec/gl-2.0/vertex-program-two-side.c<br>
+++ b/tests/spec/gl-2.0/vertex-program-two-side.c<br>
@@ -50,11 +50,12 @@ int piglit_window_mode = GLUT_RGB | GLUT_ALPHA | GLUT_DOUBLE;<br>
<br>
static GLint prog;<br>
<br>
-static bool primary = true;<br>
-static bool secondary = true;<br>
-static bool enabled = true;<br>
-static bool front = true;<br>
-static bool back = true;<br>
+static bool enabled = false;<br>
+static bool front = false;<br>
+static bool back = false;<br>
+static bool front2 = false;<br>
+static bool back2 = false;<br>
+<br>
static float frontcolor[4] = {0.0, 0.5, 0.0, 0.0};<br>
static float backcolor[4] = {0.0, 0.0, 0.5, 0.0};<br>
static float secondary_frontcolor[4] = {0.0, 0.25, 0.0, 0.0};<br>
@@ -78,51 +79,49 @@ piglit_display(void)<br>
int w = piglit_width / 2, h = piglit_height / 2;<br>
int x2 = piglit_width - w, y2 = piglit_height - h;<br>
bool pass = true;<br>
- bool draw_back = back || !enabled;<br>
<br>
glClearColor(0.5, 0.5, 0.5, 0.5);<br>
glClear(GL_COLOR_BUFFER_BIT);<br>
<br>
glUniform1i(draw_secondary_loc, false);<br>
- if (front && primary)<br>
+ if (front)<br>
piglit_draw_rect(-1, 0, 1, 1); /* top left */<br>
- if (draw_back && primary)<br>
+ if (back || (front && !enabled))<br>
piglit_draw_rect( 1, 0, -1, 1); /* top right */<br>
<br>
glUniform1i(draw_secondary_loc, true);<br>
- if (front && secondary)<br>
+ if (front2)<br>
piglit_draw_rect(-1, -1, 1, 1); /* bot left */<br>
- if (draw_back && secondary)<br>
+ if (back2 || (front2 && !enabled))<br>
piglit_draw_rect( 1, -1, -1, 1); /* bot right */<br></blockquote><div><br>Along the same lines of what I said above, I think it would be worth drawing all four rects regardless of the command-line arguments, just to make sure there isn't an assertion failure or GPU hang when drawing a rect with an undefined color. We can rely on the if tests below to ensure that we only *check* the colors in the cases where they are well-defined.<br>
</div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<br>
if (front) {<br>
- if (primary) {<br>
- pass = pass && piglit_probe_rect_rgba(x1, y2, w, h,<br>
- frontcolor);<br>
- }<br>
- if (secondary) {<br>
- pass = pass && piglit_probe_rect_rgba(x1, y1, w, h,<br>
- secondary_frontcolor);<br>
- }<br>
+ pass = pass && piglit_probe_rect_rgba(x1, y2, w, h,<br>
+ frontcolor);<br>
+ }<br>
+<br>
+ if (front2) {<br>
+ pass = pass && piglit_probe_rect_rgba(x1, y1, w, h,<br>
+ secondary_frontcolor);<br>
}<br>
<br>
- if (back && enabled) {<br>
+ if (enabled) {<br>
/* Two-sided: Get the back color/secondarycolor. */<br>
- if (primary) {<br>
+ if (back) {<br>
pass = pass && piglit_probe_rect_rgba(x2, y2, w, h,<br>
backcolor);<br>
}<br>
- if (secondary) {<br>
+ if (back2) {<br>
pass = pass && piglit_probe_rect_rgba(x2, y1, w, h,<br>
secondary_backcolor);<br>
}<br>
- } else if (back) {<br>
+ } else {<br>
/* Non-two-sided: Get the front color/secondarycolor. */<br>
- if (primary) {<br>
+ if (front) {<br>
pass = pass && piglit_probe_rect_rgba(x2, y2, w, h,<br>
frontcolor);<br>
}<br>
- if (secondary) {<br>
+ if (front2) {<br>
pass = pass && piglit_probe_rect_rgba(x2, y1, w, h,<br>
secondary_frontcolor);<br>
}<br>
@@ -168,30 +167,28 @@ piglit_init(int argc, char **argv)<br>
printf("+-------------------------+------------------------+\n");<br>
<br>
for (i = 1; i < argc; i++) {<br>
- if (strcmp(argv[i], "disabled") == 0) {<br>
- enabled = false;<br>
+ if (strcmp(argv[i], "enabled") == 0) {<br>
+ enabled = true;<br>
} else if (strcmp(argv[i], "front") == 0) {<br>
- back = false;<br>
+ front = true;<br>
} else if (strcmp(argv[i], "back") == 0) {<br>
- front = false;<br>
- } else if (strcmp(argv[i], "primary") == 0) {<br>
- secondary = false;<br>
- } else if (strcmp(argv[i], "secondary") == 0) {<br>
- primary = false;<br>
+ back = true;<br>
+ } else if (strcmp(argv[i], "front2") == 0) {<br>
+ front2 = true;<br>
+ } else if (strcmp(argv[i], "back2") == 0) {<br>
+ back2 = true;<br>
} else {<br>
fprintf(stderr, "unknown argument %s\n", argv[i]);<br>
}<br>
}<br>
<br>
- assert(enabled || front);<br>
-<br>
- if (front && primary)<br>
+ if (front)<br>
setup_output(&vs_outputs[0], "gl_FrontColor", frontcolor);<br>
- if (back && primary)<br>
+ if (back)<br>
setup_output(&vs_outputs[1], "gl_BackColor", backcolor);<br>
- if (front && secondary)<br>
+ if (front2)<br>
setup_output(&vs_outputs[2], "gl_FrontSecondaryColor", secondary_frontcolor);<br>
- if (back && secondary)<br>
+ if (back2)<br>
setup_output(&vs_outputs[3], "gl_BackSecondaryColor", secondary_backcolor);<br>
<br>
asprintf(&vs_source,<br>
<font color="#888888">--<br>
1.7.5.4<br>
<br>
_______________________________________________<br>
Piglit mailing list<br>
<a href="mailto:Piglit@lists.freedesktop.org">Piglit@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/piglit" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></blockquote></div><br>Other than the two comments above, this series is<br><br>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>