<div dir="ltr">Thanks. <br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 18, 2015 at 12:23 AM, Brian Paul <span dir="ltr"><<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 09/17/2015 04:22 PM, Juliet Fru wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This test replaces the original glean tpaths.cpp test.<br>
---<br>
tests/all.py | 1 +<br>
tests/spec/gl-1.0/CMakeLists.gl.txt | 1 +<br>
tests/spec/gl-1.0/no-op-paths.c | 308 ++++++++++++++++++++++++++++++++++++<br>
3 files changed, 310 insertions(+)<br>
create mode 100644 tests/spec/gl-1.0/no-op-paths.c<br>
<br>
diff --git a/tests/all.py b/tests/all.py<br>
index fcfc5cd..85973d6 100644<br>
--- a/tests/all.py<br>
+++ b/tests/all.py<br>
@@ -1000,6 +1000,7 @@ with profile.group_manager(<br>
g(['gl-1.0-ortho-pos'])<br>
g(['gl-1.0-readpixsanity'])<br>
g(['gl-1.0-logicop'])<br>
+ g(['gl-1.0-no-op-paths'])<br>
<br>
with profile.group_manager(<br>
PiglitGLTest,<br>
diff --git a/tests/spec/gl-1.0/CMakeLists.gl.txt b/tests/spec/gl-1.0/CMakeLists.gl.txt<br>
index d04b835..7a7f508 100644<br>
--- a/tests/spec/gl-1.0/CMakeLists.gl.txt<br>
+++ b/tests/spec/gl-1.0/CMakeLists.gl.txt<br>
@@ -22,6 +22,7 @@ piglit_add_executable (gl-1.0-front-invalidate-back front-invalidate-back.c)<br>
piglit_add_executable (gl-1.0-logicop logicop.c)<br>
piglit_add_executable (gl-1.0-long-dlist long-dlist.c)<br>
piglit_add_executable (gl-1.0-ortho-pos orthpos.c)<br>
+piglit_add_executable (gl-1.0-no-op-paths no-op-paths.c)<br>
piglit_add_executable (gl-1.0-polygon-line-aa polygon-line-aa.c)<br>
piglit_add_executable (gl-1.0-push-no-attribs push-no-attribs.c)<br>
piglit_add_executable (gl-1.0-readpixsanity readpix.c)<br>
diff --git a/tests/spec/gl-1.0/no-op-paths.c b/tests/spec/gl-1.0/no-op-paths.c<br>
new file mode 100644<br>
index 0000000..35f8c84<br>
--- /dev/null<br>
+++ b/tests/spec/gl-1.0/no-op-paths.c<br>
@@ -0,0 +1,308 @@<br>
+/* BEGIN_COPYRIGHT -*- glean -*-<br>
+ *<br>
+ * Copyright (C) 1999 Allen Akin All Rights Reserved.<br>
+ * Copyright (C) 2015 Intel Corporation.<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER<br>
+ * DEALINGS IN THE SOFTWARE.<br>
+ *<br>
+ * END_COPYRIGHT<br>
+ */<br>
+/** @file paths.c<br>
+ *<br>
+ * Test basic GL rendering paths.<br>
+ *<br>
+ *<br>
+ * Based on the original Glean tpaths.cpp test, this test verifies<br>
+ * that basic, trival OpenGL paths work as expected. For example,<br>
+ * glAlphaFunc(GL_GEQUAL, 0.0) should always pass and<br>
+ * glAlphaFunc(GL_LESS, 0.0) should always fail. We setup trivial<br>
+ * pass and fail conditions for each of alpha test, blending, color mask,<br>
+ * depth test, logic ops, scissor, stencil, stipple, and texture and<br>
+ * make sure they work as expected. We also setup trival-pass for all<br>
+ * these paths simultaneously and test that as well.<br>
+ *<br>
+ * To test for pass/fail we examine the color buffer for white or black,<br>
+ * respectively.<br>
+ *<br>
+ * Authors:<br>
+ * Brian Paul <<a href="mailto:brianp@valinux.com" target="_blank">brianp@valinux.com</a>><br>
+ * Adapted to Piglit by Juliet Fru <<a href="mailto:julietfru@gmail.com" target="_blank">julietfru@gmail.com</a>>, August 2015.<br>
+ */<br>
+<br>
+#include "piglit-util-gl.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN config.supports_gl_compat_version = 10;<br>
+<br>
+config.window_visual = PIGLIT_GL_VISUAL_RGBA |<br>
+ PIGLIT_GL_VISUAL_DOUBLE | PIGLIT_GL_VISUAL_DEPTH |<br>
+ PIGLIT_GL_VISUAL_STENCIL;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END enum path<br>
+{<br>
+ ALPHA,<br>
+ BLEND,<br>
+ COLOR_MASK,<br>
+ DEPTH,<br>
+ LOGIC,<br>
+ SCISSOR,<br>
+ STENCIL,<br>
+ STIPPLE,<br>
+ TEXTURE,<br>
+ NUM_PATHS /* end-of-list token */<br>
+};<br>
+<br>
+enum state<br>
+{<br>
+ DISABLE,<br>
+ ALWAYS_PASS,<br>
+ ALWAYS_FAIL<br>
+};<br>
+<br>
+const char *<br>
+path_name(enum path paths)<br>
+{<br>
+ switch (paths) {<br>
+ case ALPHA:<br>
+ return "Alpha Test";<br>
+ case BLEND:<br>
+ return "Blending";<br>
+ case COLOR_MASK:<br>
+ return "Color Mask";<br>
+ case DEPTH:<br>
+ return "Depth Test";<br>
+ case LOGIC:<br>
+ return "LogicOp";<br>
+ case SCISSOR:<br>
+ return "Scissor Test";<br>
+ case STENCIL:<br>
+ return "Stencil Test";<br>
+ case STIPPLE:<br>
+ return "Polygon Stipple";<br>
+ case TEXTURE:<br>
+ return "Modulated Texture";<br>
+ case NUM_PATHS:<br>
+ return "paths";<br>
+ default:<br>
+ return "BAD PATH VALUE!";<br>
+ }<br>
+}<br>
+<br>
+void<br>
+set_path_state(enum path paths, enum state states)<br>
+{<br>
+ int i;<br>
+ switch (paths) {<br>
+ case ALPHA:<br>
+ if (states == ALWAYS_PASS) {<br>
+ glAlphaFunc(GL_GEQUAL, 0.0);<br>
+ glEnable(GL_ALPHA_TEST);<br>
+ } else if (states == ALWAYS_FAIL) {<br>
+ glAlphaFunc(GL_GREATER, 1.0);<br>
+ glEnable(GL_ALPHA_TEST);<br>
+ } else {<br>
+ glDisable(GL_ALPHA_TEST);<br>
+ }<br>
+ break;<br>
+ case BLEND:<br>
+ if (states == ALWAYS_PASS) {<br>
+ glBlendFunc(GL_ONE, GL_ZERO);<br>
+ glEnable(GL_BLEND);<br>
+ } else if (states == ALWAYS_FAIL) {<br>
+ glBlendFunc(GL_ZERO, GL_ONE);<br>
+ glEnable(GL_BLEND);<br>
+ } else {<br>
+ glDisable(GL_BLEND);<br>
+ }<br>
+ break;<br>
+ case COLOR_MASK:<br>
+ if (states == ALWAYS_PASS) {<br>
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);<br>
+ } else if (states == ALWAYS_FAIL) {<br>
+ glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);<br>
+ } else {<br>
+ glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);<br>
+ }<br>
+ break;<br>
+ case DEPTH:<br>
+ if (states == ALWAYS_PASS) {<br>
+ glDepthFunc(GL_ALWAYS);<br>
+ glEnable(GL_DEPTH_TEST);<br>
+ } else if (states == ALWAYS_FAIL) {<br>
+ glDepthFunc(GL_NEVER);<br>
+ glEnable(GL_DEPTH_TEST);<br>
+ } else {<br>
+ glDisable(GL_DEPTH_TEST);<br>
+ }<br>
+ break;<br>
+ case LOGIC:<br>
+ if (states == ALWAYS_PASS) {<br>
+ glLogicOp(GL_OR);<br>
+ glEnable(GL_COLOR_LOGIC_OP);<br>
+ } else if (states == ALWAYS_FAIL) {<br>
+ glLogicOp(GL_AND);<br>
+ glEnable(GL_COLOR_LOGIC_OP);<br>
+ } else {<br>
+ glDisable(GL_COLOR_LOGIC_OP);<br>
+ }<br>
+ break;<br>
+ case SCISSOR:<br>
+ if (states == ALWAYS_PASS) {<br>
+ glScissor(0, 0, piglit_width, piglit_height);<br>
+ glEnable(GL_SCISSOR_TEST);<br>
+ } else if (states == ALWAYS_FAIL) {<br>
+ glScissor(0, 0, 0, 0);<br>
+ glEnable(GL_SCISSOR_TEST);<br>
+ } else {<br>
+ glDisable(GL_SCISSOR_TEST);<br>
+ }<br>
+ break;<br>
+ case STENCIL:<br>
+ if (states == ALWAYS_PASS) {<br>
+ /* pass if reference <= stencil value (ref = 0) */<br>
+ glStencilFunc(GL_LEQUAL, 0, ~0);<br>
+ glEnable(GL_STENCIL_TEST);<br>
+ } else if (states == ALWAYS_FAIL) {<br>
+ /* pass if reference > stencil value (ref = 0) */<br>
+ glStencilFunc(GL_GREATER, 0, ~0);<br>
+ glEnable(GL_STENCIL_TEST);<br>
+ } else {<br>
+ glDisable(GL_STENCIL_TEST);<br>
+ }<br>
+ break;<br>
+ case STIPPLE:<br>
+ if (states == ALWAYS_PASS) {<br>
+ GLubyte stipple[4 * 32];<br>
+ for (i = 0; i < 4 * 32; i++)<br>
+ stipple[i] = 0xff;<br>
+ glPolygonStipple(stipple);<br>
+ glEnable(GL_POLYGON_STIPPLE);<br>
+ } else if (states == ALWAYS_FAIL) {<br>
+ GLubyte stipple[4 * 32];<br>
+ for (i = 0; i < 4 * 32; i++)<br>
+ stipple[i] = 0x0;<br>
+ glPolygonStipple(stipple);<br>
+ glEnable(GL_POLYGON_STIPPLE);<br>
+ } else {<br>
+ glDisable(GL_POLYGON_STIPPLE);<br>
+ }<br>
+ break;<br>
+ case TEXTURE:<br>
+ if (states == DISABLE) {<br>
+ glDisable(GL_TEXTURE_2D);<br>
+ } else {<br>
+ GLubyte val = (states == ALWAYS_PASS) ? 0xff : 0x00;<br>
+ GLubyte texImage[4 * 4 * 4];<br>
+ for (i = 0; i < 4 * 4 * 4; i++)<br>
+ texImage[i] = val;<br>
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 4, 4, 0,<br>
+ GL_RGBA, GL_UNSIGNED_BYTE, texImage);<br>
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,<br>
+ GL_NEAREST);<br>
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,<br>
+ GL_NEAREST);<br>
+ glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,<br>
+ GL_MODULATE);<br>
+ glEnable(GL_TEXTURE_2D);<br>
+ }<br>
+ break;<br>
+ default:<br>
+ break;<br>
+ }<br>
+}<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+ /* No init */<br>
+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+ bool pass = true;<br>
+ int i;<br>
+ <br>
+ static const float white[3] = { 1.0, 1.0, 1.0 };<br>
+ static const float black[3] = { 0.0, 0.0, 0.0 };<br>
+<br>
+ piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);<br>
+ glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+ glDisable(GL_DITHER);<br>
+ glClear(GL_COLOR_BUFFER_BIT);<br>
</blockquote>
<br></div></div>
I guess I didn't notice there was already a glClear() call here. The scond one can be removed. I can take care of that.<div><div class="h5"><br>
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ <br>
+ /* test always-pass paths */<br>
+ for (i = 0; i < NUM_PATHS; i++) {<br>
+ set_path_state(i, ALWAYS_PASS);<br>
+<br>
+ /* draw polygon */<br>
+ piglit_draw_rect(i * 10, 0, 10, 10);<br>
+<br>
+ set_path_state(i, DISABLE);<br>
+<br>
+ /* test buffer */<br>
+ if (!piglit_probe_pixel_rgb(i * 10 + 4, 4, white)) {<br>
+ printf("Failure with path %s set to always pass.\n",<br>
+ path_name(i));<br>
+<br>
+ pass = false;<br>
+ }<br>
+ }<br>
+<br>
+ /* enable all always-pass paths */<br>
+ {<br>
+ for (i = 0; i < NUM_PATHS; i++) {<br>
+ set_path_state(i, ALWAYS_PASS);<br>
+ }<br>
+<br>
+ /* draw polygon */<br>
+ piglit_draw_rect(0, 10, 10, 10);<br>
+<br>
+ for (i = 0; i < NUM_PATHS; i++) {<br>
+ set_path_state(i, DISABLE);<br>
+ }<br>
+<br>
+ /* test buffer */<br>
+ if (!piglit_probe_pixel_rgb(4, 14, white)) {<br>
+ printf("Failure with always-pass paths enabled.\n");<br>
+ pass = false;<br>
+ }<br>
+ }<br>
+<br>
+ /* test never-pass paths */<br>
+ for (i = 0; i < NUM_PATHS; i++) {<br>
+ set_path_state(i, ALWAYS_FAIL);<br>
+<br>
+ /* draw polygon */<br>
+ piglit_draw_rect(10 * i, 20, 10, 10);<br>
+<br>
+ set_path_state(i, DISABLE);<br>
+<br>
+ /* test buffer */<br>
+ if (!piglit_probe_pixel_rgb(10 * i + 4, 24, black)) {<br>
+ printf("Failure with %s set to fail mode.\n",<br>
+ path_name(i));<br>
+ pass = false;<br>
+ }<br>
+ }<br>
+<br>
+ piglit_present_results();<br>
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
<br>
</blockquote>
<br></div></div>
OK, I think this looks pretty good.<br>
<br>
Reviewed-by: Brian Paul <<a href="mailto:brianp@vmware.com" target="_blank">brianp@vmware.com</a>><br>
<br>
I'll commit this later (and the other patch that removed the glean test).<br>
<br>
Thanks for sticking with it!<span class="HOEnZb"><font color="#888888"><br>
<br>
-Brian<br>
<br>
<br>
<br>
<br>
</font></span></blockquote></div><br></div>