From c9dd0eb7b524e0b790c4aa654c0a1852f7505cec Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 30 Mar 2016 09:33:24 -0400 Subject: [PATCH] Recreate GLTextureSources after changing compositors on Mac. (bug 1247611, r=mattwoodrow) --- gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp | 8 +++++--- gfx/layers/opengl/TextureHostOGL.cpp | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp index 87a55faba4f0..3eab61615eb8 100644 --- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp +++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp @@ -73,11 +73,13 @@ MacIOSurfaceTextureHostOGL::SetCompositor(Compositor* aCompositor) mCompositor = nullptr; return; } + CompositorOGL* glCompositor = static_cast(aCompositor); - mCompositor = glCompositor; - if (mTextureSource) { - mTextureSource->SetCompositor(glCompositor); + if (mCompositor != glCompositor) { + // Cannot share GL texture identifiers across compositors. + mTextureSource = nullptr; } + mCompositor = glCompositor; } gfx::SurfaceFormat diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index 579af7927e53..d884ed07043a 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -353,6 +353,11 @@ GLTextureSource::SetCompositor(Compositor* aCompositor) if (!AssertGLCompositor(aCompositor)) { return; } + + if (mCompositor && mCompositor != aCompositor) { + gfxCriticalError() << "GLTextureSource does not support changing compositors"; + } + mCompositor = static_cast(aCompositor); if (mNextSibling) { mNextSibling->SetCompositor(aCompositor);