<div dir="ltr"><div><div><div>Hello IIia,<br><br></div>Thank you for the corrections. I will make these changes and submit.<br><br></div>Regards,<br></div>Juliet<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 1, 2015 at 11:17 PM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</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 Tue, Sep 1, 2015 at 5:49 PM, Juliet Fru <<a href="mailto:julietfru@gmail.com">julietfru@gmail.com</a>> wrote:<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 | 332 ++++++++++++++++++++++++++++++++++++<br>
> 3 files changed, 334 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..ea4abf5<br>
> --- /dev/null<br>
> +++ b/tests/spec/gl-1.0/no-op-paths.c<br>
> @@ -0,0 +1,332 @@<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">brianp@valinux.com</a>><br>
> + * Adapted to Piglit by Juliet Fru <<a href="mailto:julietfru@gmail.com">julietfru@gmail.com</a>>, August 2015.<br>
> + */<br>
> +<br>
> +#include "piglit-util-gl.h"<br>
> +<br>
> +PIGLIT_GL_TEST_CONFIG_BEGIN<br>
> +<br>
> + 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>
> +<br>
> +PIGLIT_GL_TEST_CONFIG_END<br>
> +<br>
> +enum path {<br>
> + ALPHA,<br>
> + BLEND,<br>
> + COLOR_MASK,<br>
> + DEPTH,<br>
> + LOGIC,<br>
> + SCISSOR,<br>
> + STENCIL,<br>
> + STIPPLE,<br>
> + TEXTURE,<br>
> + ZZZ /* end-of-list token */<br>
> +};<br>
> +<br>
> +enum state{<br>
<br>
</div></div>Missing space<br>
<span class=""><br>
> + DISABLE,<br>
> + ALWAYS_PASS,<br>
> + ALWAYS_FAIL<br>
> +};<br>
> +<br>
> +const char *<br>
<br>
</span>static<br>
<div><div class="h5"><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 ZZZ:<br>
> + return "paths";<br>
> + }<br>
> +}<br>
> +<br>
> +void<br>
<br>
</div></div>static<br>
<div><div class="h5"><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>
> + }<br>
> + else if (states == ALWAYS_FAIL) {<br>
> + glAlphaFunc(GL_GREATER, 1.0);<br>
> + glEnable(GL_ALPHA_TEST);<br>
> + }<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>
> + }<br>
> + else if (states == ALWAYS_FAIL) {<br>
> + glBlendFunc(GL_ZERO, GL_ONE);<br>
> + glEnable(GL_BLEND);<br>
> + }<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>
> + }<br>
> + else if (states == ALWAYS_FAIL) {<br>
> + glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);<br>
> + }<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>
> + }<br>
> + else if (states == ALWAYS_FAIL) {<br>
> + glDepthFunc(GL_NEVER);<br>
> + glEnable(GL_DEPTH_TEST);<br>
> + }<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>
> + }<br>
> + else if (states == ALWAYS_FAIL) {<br>
> + glLogicOp(GL_AND);<br>
> + glEnable(GL_COLOR_LOGIC_OP);<br>
> + }<br>
> + else {<br>
> + glDisable(GL_COLOR_LOGIC_OP);<br>
> + }<br>
> + break;<br>
> + case SCISSOR:<br>
> + if (states == ALWAYS_PASS) {<br>
> + glScissor(0, 0, 10, 10);<br>
> + glEnable(GL_SCISSOR_TEST);<br>
> + }<br>
> + else if (states == ALWAYS_FAIL) {<br>
> + glScissor(0, 0, 0, 0);<br>
> + glEnable(GL_SCISSOR_TEST);<br>
> + }<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>
> + }<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>
> + }<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>
> + }<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>
> + }<br>
> + else {<br>
> + glDisable(GL_POLYGON_STIPPLE);<br>
> + }<br>
> + break;<br>
> + case TEXTURE:<br>
> + if (states == DISABLE) {<br>
> + glDisable(GL_TEXTURE_2D);<br>
> + }<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>
> + enum path p, paths[10];<br>
> + int i, num_paths = 0;<br>
> +<br>
> + static const float white[3] = {1.0, 1.0, 1.0};<br>
> +<br>
> + /* draw 10x10 pixel quads */<br>
> + glViewport(0, 0, 10, 10);<br>
<br>
</div></div>Perhaps you can improve this test while you're at it? Right now if one<br>
thing fails, that's it the whole test fails and you have no idea if<br>
anything down the line fails, or conversely if everything else is<br>
alright and it's just that one thing.<br>
<br>
Instead you could do something like<br>
<br>
piglit_ortho_projection(piglit_width, piglit_height, GL_FALSE);<br>
<span class=""><br>
> +<br>
> + glDisable(GL_DITHER);<br>
> +<br>
> + /* Build the list of paths to exercise */<br>
> + for (p = ALPHA; p != ZZZ; p = (enum path) (p + 1)) {<br>
> + paths[num_paths++] = p;<br>
> + }<br>
<br>
</span>I'm a little confused what this adds. Why not just do<br>
<br>
num_paths = ZZZ;<br>
<br>
and then just use i instead of paths[i] everywhere?<br>
<span class=""><br>
> +<br>
> + /* test always-pass paths */<br>
> + for (i = 0; i < num_paths; i++) {<br>
> + glClear(GL_COLOR_BUFFER_BIT);<br>
> +<br>
> + set_path_state(paths[i], ALWAYS_PASS);<br>
> +<br>
> + /* draw polygon */<br>
> + piglit_draw_rect(-1, -1, 2, 2);<br>
<br>
</span>piglit_draw_rect(i * 10, 0, 10, 10);<br>
<br>
> +<br>
> +<br>
<span class="">> + set_path_state(paths[i], DISABLE);<br>
> +<br>
> + /* test buffer */<br>
</span>> + if (!piglit_probe_pixel_rgb(i * 10 + 4, 4, white)) {<br>
<br>
pass = false;<br>
<span class=""><br>
> + piglit_present_results();<br>
> + return PIGLIT_FAIL;<br>
<br>
</span>and remove that.<br>
<span class=""><br>
> + }<br>
> + }<br>
> +<br>
> + /* enable all always-pass paths */<br>
> + {<br>
> + glClear(GL_COLOR_BUFFER_BIT);<br>
> +<br>
> + for (i = 0; i < num_paths; i++) {<br>
> + set_path_state(paths[i], ALWAYS_PASS);<br>
> + }<br>
> +<br>
> + /* draw polygon */<br>
> + piglit_draw_rect(-1, -1, 2, 2);<br>
<br>
</span>piglit_draw_rect(10, 10, 10, 10);<br>
<span class=""><br>
> +<br>
> + for (i = 0; i < num_paths; i++) {<br>
> + set_path_state(paths[i], DISABLE);<br>
> + }<br>
> +<br>
> + /* test buffer */<br>
> + if (!piglit_probe_pixel_rgb(4, 4, white)) {<br>
> + piglit_present_results();<br>
> + return PIGLIT_FAIL;<br>
> + }<br>
> + }<br>
> +<br>
> + /* test never-pass paths */<br>
> + for (i = 0; i < num_paths; i++) {<br>
> + glClear(GL_COLOR_BUFFER_BIT);<br>
> +<br>
> + set_path_state(paths[i], ALWAYS_FAIL);<br>
> +<br>
> + /* draw polygon */<br>
> + piglit_draw_rect(-1, -1, 2, 2);<br>
<br>
</span>piglit_draw_rect(10 * i, 20, 10, 10);<br>
<span class=""><br>
> +<br>
> + set_path_state(paths[i], DISABLE);<br>
> +<br>
> + /* test buffer */<br>
> + if (!piglit_probe_pixel_rgb(4, 4, white)) {<br>
> + piglit_present_results();<br>
> + return PIGLIT_FAIL;<br>
> + }<br>
> + }<br>
> +<br>
> + piglit_present_results();<br>
> + return PIGLIT_PASS;<br>
<br>
</span>return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
<br>
That way you should end up with all the fails even if only a few of<br>
them fails in the middle.<br>
<br>
> +}<br>
<span class="HOEnZb"><font color="#888888">> --<br>
> 2.4.3<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" rel="noreferrer" target="_blank">http://lists.freedesktop.org/mailman/listinfo/piglit</a><br>
</font></span></blockquote></div><br></div>