Mesa (master): intel: flush old context before binding new context
Brian Paul
brianp at kemper.freedesktop.org
Fri Oct 23 00:41:58 UTC 2009
Module: Mesa
Branch: master
Commit: 55058652b886b95bfc24109a9edb04d274c01c1a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=55058652b886b95bfc24109a9edb04d274c01c1a
Author: Brian Paul <brianp at vmware.com>
Date: Thu Oct 22 18:32:48 2009 -0600
intel: flush old context before binding new context
Per the GLX spec, when changing rendering contexts, the old context
should first be flushed.
---
src/mesa/drivers/dri/intel/intel_context.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c
index d24af46..ddb0550 100644
--- a/src/mesa/drivers/dri/intel/intel_context.c
+++ b/src/mesa/drivers/dri/intel/intel_context.c
@@ -944,10 +944,23 @@ intelMakeCurrent(__DRIcontextPrivate * driContextPriv,
__DRIdrawablePrivate * driReadPriv)
{
__DRIscreenPrivate *psp = driDrawPriv->driScreenPriv;
+ struct intel_context *intel;
+ GET_CURRENT_CONTEXT(curCtx);
+
+ if (driContextPriv)
+ intel = (struct intel_context *) driContextPriv->driverPrivate;
+ else
+ intel = NULL;
+
+ /* According to the glXMakeCurrent() man page: "Pending commands to
+ * the previous context, if any, are flushed before it is released."
+ * But only flush if we're actually changing contexts.
+ */
+ if (intel_context(curCtx) && intel_context(curCtx) != intel) {
+ _mesa_flush(curCtx);
+ }
if (driContextPriv) {
- struct intel_context *intel =
- (struct intel_context *) driContextPriv->driverPrivate;
struct intel_framebuffer *intel_fb =
(struct intel_framebuffer *) driDrawPriv->driverPrivate;
GLframebuffer *readFb = (GLframebuffer *) driReadPriv->driverPrivate;
More information about the mesa-commit
mailing list