<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 | 1 +<br>
tests/spec/gl-3.2/draw-buffers-errors.c | 116 ++++++++++++++++++++++++++++++++<br>
2 files changed, 117 insertions(+)<br>
create mode 100644 tests/spec/gl-3.2/draw-buffers-errors.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 c6c99b8..49e9279 100644<br>
--- a/tests/spec/gl-3.2/CMakeLists.gl.txt<br>
+++ b/tests/spec/gl-3.2/CMakeLists.gl.txt<br>
@@ -10,5 +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>
<br>
# vim: ft=cmake:<br>
diff --git a/tests/spec/gl-3.2/draw-buffers-errors.c b/tests/spec/gl-3.2/draw-buffers-errors.c<br>
new file mode 100644<br>
index 0000000..dae753a<br>
--- /dev/null<br>
+++ b/tests/spec/gl-3.2/draw-buffers-errors.c<br>
@@ -0,0 +1,116 @@<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 DrawBuffers() returns correct error message for different values<br>
+ *<br>
+ * Section 4.2.1(Selecting a Buffer for Writing) of OpenGL 3.2 Core says:<br>
+ *<br>
+ * "For both the default framebuffer and framebuffer objects, the constants<br>
+ * FRONT, BACK, LEFT, RIGHT, and FRONT_AND_BACK are not valid in the bufs<br>
+ * array passed to DrawBuffers, and will result in the error INVALID_ENUM."<br>
+ *<br>
+ * "If the GL is bound to the default framebuffer and DrawBuffers is supplied<br>
+ * with a constant (other than NONE) that does not indicate any of the color<br>
+ * buffers allocated to the GL context by the window system, the error<br>
+ * INVALID_OPERATION will be generated."<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>
+<br>
+ config.window_visual = PIGLIT_GL_VISUAL_DOUBLE;<br>
+<br>
+PIGLIT_GL_TEST_CONFIG_END<br>
+<br>
+<br>
+static GLenum invalids[]={GL_FRONT,<br>
+ GL_BACK,<br>
+ GL_LEFT,<br>
+ GL_RIGHT,<br>
+ GL_FRONT_AND_BACK};<br>
+<br>
+static GLenum valids[] = {GL_NONE,<br>
+ GL_FRONT_LEFT,<br>
+ GL_FRONT_RIGHT,<br>
+ GL_BACK_LEFT,<br>
+ GL_BACK_RIGHT};<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+ bool pass = true;<br>
+ int i = 0;<br>
+<br>
+ glClearColor(0, 1, 0 , 1);<br>
+ glClear(GL_COLOR_BUFFER_BIT);<br>
+<br>
+// printf("Expected GL_WAIT_FAILED but returned: %s\n",<br>
+// piglit_get_gl_enum_name(status1));<br>
+// pass = false;<br>
+<br>
+ for (i = 0; i < 5; i++) {<br>
+ GLenum err = 0;<br>
+ glDrawBuffers(1, &valids[i]);<br>
+ err = glGetError();<br>
+ /* err = INVALID_OPERATION if that color buffer is not<br>
+ allocated to the window system */<br></blockquote><div><br></div><div>Sorry, I accidentally hit send too early.<br><br></div><div>The above comment should be formatted like so:<br><br> /* err = INVALID_OPERATION if that color buffer is not<br>
* allocated to the window system<br> */<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">
+ if(err != GL_NONE && err != GL_INVALID_OPERATION) {<br>
+ printf("Expected GL_NONE or GL_INVALID_OPERATION with"<br>
+ " %s but received: %s\n",<br>
+ piglit_get_gl_enum_name(valids[i]),<br>
+ piglit_get_gl_enum_name(err));<br>
+ pass = false;<br>
+ }<br>
+ }<br>
+<br>
+ for (i = 0; i < 5; i++) {<br>
+ GLenum err = 0;<br>
+ glDrawBuffers(1, &invalids[i]);<br>
+ err = glGetError();<br>
+ if(err != GL_INVALID_ENUM) {<br>
+ printf("Expected GL_INVALID_ENUM with %s but "<br>
+ "received: %s\n",<br>
+ piglit_get_gl_enum_name(invalids[i]),<br>
+ piglit_get_gl_enum_name(err));<br>
+ pass = false;<br>
+ }<br>
+ }<br>
+<br>
+ if(!pass) {<br>
+ glClearColor(1, 0, 0 , 1);<br>
+ glClear(GL_COLOR_BUFFER_BIT);<br>
+ }<br>
+<br>
+ piglit_present_results();<br></blockquote><div><br></div><div>It's not necessary to render anything for an API test like this one. I'd recommend dropping the calls to glClearColor(), glClear(), and piglit_present_results().<br>
<br></div><div>With those items fixed (and the issues from my previous email), this test is:<br><br></div><div>Reviewed-by: Paul Berry <<a href="mailto:stereotype441@gmail.com">stereotype441@gmail.com</a>><br></div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
+<br>
+ return pass ? PIGLIT_PASS : PIGLIT_FAIL;<br>
+}<br>
+void<br>
+piglit_init(int argc, char **argv)<br>
+{<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>