On Tue, Jan 10, 2012 at 1:36 AM, Yi Sun <span dir="ltr"><<a href="mailto:yi.sun@intel.com">yi.sun@intel.com</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">
From: Sun Yi <<a href="mailto:yi.sun@intel.com">yi.sun@intel.com</a>><br>
<br>
Test swapping buffers on NULL context.<br>
Verify that swapping buffers without active context is ignored.<br>
Test rendered a triangle afterwards active context is deselected<br>
and buffers swapping is performed by calling function glXSwapBuffers.<br>
<br>
Signed-off-by: Yi Sun <<a href="mailto:yi.sun@intel.com">yi.sun@intel.com</a>><br>
---<br>
tests/spec/gl-2.1/CMakeLists.gl.txt | 1 +<br>
tests/spec/gl-2.1/swapbuffer.c | 65 +++++++++++++++++++++++++++++++++++<br>
2 files changed, 66 insertions(+), 0 deletions(-)<br>
create mode 100644 tests/spec/gl-2.1/swapbuffer.c<br>
<br>
diff --git a/tests/spec/gl-2.1/CMakeLists.gl.txt b/tests/spec/gl-2.1/CMakeLists.gl.txt<br>
index 9a4afbe..c1002f6 100644<br>
--- a/tests/spec/gl-2.1/CMakeLists.gl.txt<br>
+++ b/tests/spec/gl-2.1/CMakeLists.gl.txt<br>
@@ -14,3 +14,4 @@ link_libraries (<br>
)<br>
<br>
add_executable (gl-2.1-minmax minmax.c)<br>
+add_executable (swapbuffer swapbuffer.c)<br>
diff --git a/tests/spec/gl-2.1/swapbuffer.c b/tests/spec/gl-2.1/swapbuffer.c<br>
new file mode 100644<br>
index 0000000..ff7920a<br>
--- /dev/null<br>
+++ b/tests/spec/gl-2.1/swapbuffer.c<br>
@@ -0,0 +1,65 @@<br>
+/* Copyright © 2012 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>
+ * file swapbuffer.c<br>
+ *<br>
+ * Test swapping buffers on NULL context.<br>
+ * Verify that swapping buffers without active context is ignored.<br></blockquote><div>glXSwapBuffers() doesn't require gl context. I think swap buffer can still happen</div><div>as expected.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ * Test rendered a triangle afterwards active context is deselected<br>
+ * and buffers swapping is performed.<br>
+ *<br></blockquote><div>You are rendering the triangle before making the context null. So the triangle</div><div>will be rendered to frame buffer and will be visible after swap buffers.</div><div>You should also render another triangle with different vertex coordinates after making</div>
<div>the context null and make sure that triangle don't modify frame buffer.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ * Test is expected no crash occurs during testcase execution.<br>
+ *<br>
+ * Author Yi Sun <<a href="mailto:yi.sun@intel.com">yi.sun@intel.com</a>><br>
+ */<br>
+<br>
+#include "piglit-util.h"<br>
+#include <X11/Xlib.h><br>
+#include <GL/glx.h><br>
+<br>
+int piglit_width = 100, piglit_height = 100;<br>
+int piglit_window_mode = GLUT_RGB | GLUT_DOUBLE;<br>
+<br>
+<br>
+enum piglit_result<br>
+piglit_display(void)<br>
+{<br>
+ glBegin(GL_TRIANGLES);<br>
+ glVertex2f(0,0);<br>
+ glVertex2f(0,1);<br>
+ glVertex2f(1,1);<br>
+ glEnd();<br>
+<br>
+ Display *dpy = glXGetCurrentDisplay();<br>
+ GLXDrawable draw = glXGetCurrentDrawable();<br>
+<br>
+ glXMakeContextCurrent(dpy, 0, 0, 0); //deselect the context<br>
+ glXSwapBuffers(dpy, draw); //swap buffer, no crashing expected<br>
+<br>
+ return PIGLIT_PASS;<br>
+}<br>
+<br>
+void piglit_init(int argc, char **argv)<br>
+{<br>
+<br>
+}<br><span class="HOEnZb"><font color="#888888"><br></font></span></blockquote><div>Thanks for the test case. I'm able to reproduce the issue. Will send out a patch to fix the issue.</div></div><br>