<div dir="ltr">On 6 August 2013 10:29, Nicholas Mack <span dir="ltr"><<a href="mailto:nichmack@gmail.com" target="_blank">nichmack@gmail.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
---<br>
 tests/spec/gl-3.2/CMakeLists.gl.txt  |  2 +-<br>
 tests/spec/gl-3.2/clear-no-buffers.c | 90 ++++++++++++++++++++++++++++++++++++<br></blockquote><div><br></div><div>This test also needs to be added to all.tests.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

 2 files changed, 91 insertions(+), 1 deletion(-)<br>
 create mode 100644 tests/spec/gl-3.2/clear-no-buffers.c<br>
<br>
diff --git a/tests/spec/gl-3.2/CMakeLists.gl.txt b/tests/spec/gl-3.2/CMakeLists.gl.txt<br>
index 49e9279..1e2225a 100644<br>
--- a/tests/spec/gl-3.2/CMakeLists.gl.txt<br>
+++ b/tests/spec/gl-3.2/CMakeLists.gl.txt<br>
@@ -10,6 +10,6 @@ link_libraries (<br>
 )<br>
<br>
 piglit_add_executable (gl-3.2-minmax minmax.c)<br>
-piglit_add_executable (gl-3.2-draw-buffers-errors draw-buffers-errors.c)<br>
+piglit_add_executable (gl-3.2-clear-none clear-no-buffers.c)<br></blockquote><div><br></div><div>Don't remove the piglit_add_executable(...) declaration from the previous test.  Just add the new declaration for this test.<br>
<br></div><div>Also, please name the test executable consistently with the .c file, e.g.<br><br></div><div>piglit_add_executable (gl-3.2-clear-no-buffers clear-no-buffers.c)<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<br>
 # vim: ft=cmake:<br>
diff --git a/tests/spec/gl-3.2/clear-no-buffers.c b/tests/spec/gl-3.2/clear-no-buffers.c<br>
new file mode 100644<br>
index 0000000..52566fc<br>
--- /dev/null<br>
+++ b/tests/spec/gl-3.2/clear-no-buffers.c<br>
@@ -0,0 +1,90 @@<br>
+/**<br>
+ * Copyright © 2013 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 DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+/**<br>
+ * Test that Clear() clears no buffers when passed 0<br>
+ *<br>
+ * Section 4.2.3(Clearing the Buffers) of OpenGL 3.2 Core says:<br>
+ * "The value to which each buffer is cleared depends on the setting of the<br>
+ *  clear value for that buffer. If buf is zero, no buffers are cleared."<br>
+ *<br>
+ */<br>
+<br>
+#include "piglit-util-gl-common.h"<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_BEGIN<br>
+<br>
+       config.supports_gl_compat_version = 10;<br>
+        //config.supports_gl_core_version = 32;<br></blockquote><div><br></div><div>As with the previous patch, this should be:<br><br>    config.supports_gl_compat_version = 32;<br>    config.supports_gl_core_version = 32;<br>
<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+        config.window_width = 64;<br>
+        config.window_height = 64;<br></blockquote><div><br></div><div>We try not to set the window width and height unless the test specifically requires a certain window size.  This test should work at any window size, so I would recommend dropping the above two lines.<br>
</div><div><br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+        config.window_visual = PIGLIT_GL_VISUAL_RGB |<br>
+                               PIGLIT_GL_VISUAL_DOUBLE |<br>
+                               PIGLIT_GL_VISUAL_DEPTH |<br>
+                               PIGLIT_GL_VISUAL_STENCIL;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+//static GLuint fbo;<br>
+<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<br>
+       //glGenFramebuffers(1, &fbo);<br></blockquote><div><br></div><div>This extraneous comment (and the two in piglit_display) should be removed.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

+}<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+       bool pass = true;<br>
+       float green[] = {0, 1, 0};<br>
+<br>
+       glEnable(GL_DEPTH_TEST);<br>
+       //glDepthFunc(GL_LEQUAL);<br>
+<br>
+       /* Set first base values to the buffers */<br>
+       glClearColor(0.0, 1.0, 0.0, 1.0);<br>
+       glClearDepth(.8);<br>
+       glClearStencil(1);<br>
+       //glClearBufferfi(GL_DEPTH_STENCIL, 0, .8, 1);<br>
+       glClear(GL_COLOR_BUFFER_BIT |<br>
+               GL_DEPTH_BUFFER_BIT |<br>
+               GL_STENCIL_BUFFER_BIT);<br>
+<br>
+       /* Set a second value to the buffers */<br>
+       glClearColor(1.0, 0.0, 0.0, 1.0);<br>
+       glClearDepth(.2);<br>
+       glClearStencil(2);<br>
+<br>
+       glClear(0);<br></blockquote><div><br></div><div>If the call to glClear() causes a GL error and does nothing, the test will pass.  To make sure that error condition gets caught, I'd recommend adding:<br><br>    if (!piglit_check_gl_error(GL_NO_ERROR))<br>
        pass = false;<br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+       /* if probe returns the first value, glClear(0) didn't clear values */<br>
+       pass = piglit_probe_pixel_rgb(32, 32, green) && pass;<br>
+       pass = piglit_probe_pixel_depth(32, 32, .8) && pass;<br>
+       pass = piglit_probe_pixel_stencil(32, 32, 1) && pass;<br></blockquote><div><br></div><div>Usually for tests like this, we go ahead and probe the entire output window, rather than just a single pixel, like so: <br>
</div><div><br></div><div>pass = piglit_probe_rect_rgb(0, 0, piglit_width, piglit_height, green) && pass;<br></div><div>pass = piglit_probe_rect_depth(0, 0, piglit_width, piglit_height, .8) && pass;<br></div>
<div>pass = piglit_probe_rect_stencil(0, 0, piglit_width, piglit_height, 1) && pass;<br><br></div><div>With those comments all addressed, this patch is:<br><br></div><div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br>
</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+       piglit_present_results();<br>
+<br>
+       return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
<span class=""><font color="#888888">--<br>
1.8.3.1<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></span></blockquote></div><br></div></div>