summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllen Akin <akin@arden.org>2009-06-24 10:19:03 -0700
committerAllen Akin <akin@arden.org>2009-06-24 10:23:16 -0700
commita1f4664cf13657ffd1c7e3ff7c11142dec4e28e8 (patch)
tree821519a8cad4e34f6546f83d993341bfb321be1c
parent732edeadf4360cd48f386ec24e40cb095a5a95ec (diff)
Ensure GL command queues are empty
If the implementation doesn't mark the GL command queue as empty after a glReadPixels command, this prevents GLXBadCurrentWindow errors from occurring on glXMakeCurrent commands issued after the window is destroyed.
-rw-r--r--src/glean/tbinding.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/glean/tbinding.cpp b/src/glean/tbinding.cpp
index 6aedd02..c73cfae 100644
--- a/src/glean/tbinding.cpp
+++ b/src/glean/tbinding.cpp
@@ -88,7 +88,6 @@ MakeCurrentTest::runOne(MakeCurrentResult& r, Window& w) {
// The rendering contexts to be used:
vector<RenderingContext*> rcs;
- // Short descriptions of the rendering contexts:
RandomBitsDouble rRand(config.r, 712105);
RandomBitsDouble gRand(config.g, 63230);
@@ -153,8 +152,24 @@ failed:
r.pass = false;
cleanup:
for (i = 0; i < static_cast<int>(rcs.size()); ++i)
- if (rcs[i])
+ if (rcs[i]) {
+ // We need to make sure that no GL commands are
+ // pending when the window is destroyed, or we
+ // risk a GLXBadCurrentWindow error at some
+ // indeterminate time in the future when
+ // glXMakeCurrent() is executed.
+ // In theory, if glReadPixels() is the last
+ // command executed by a test, then an implicit
+ // flush has occurred, and the command queue is
+ // empty. In practice, we have to protect
+ // against the possibility that the implicit
+ // flush is not enough to avoid the error.
+ ws.makeCurrent(*rcs[i], w);
+ glFinish();
+ ws.makeCurrent();
+
delete rcs[i];
+ }
} // MakeCurrentTest::runOne
///////////////////////////////////////////////////////////////////////////////