Bug 1195531 - Don't discard d3d11 textures when we move the TextureSource to a new compositor. r=jrmuizel,nical
authorMatt Woodrow <mwoodrow@mozilla.com>
Tue, 18 Aug 2015 14:32:33 -0400
changeset 258252 32454b3c22cd1bfa01306bae16d529617ae8bd70
parent 258251 5fca4c1a59a244581bab18e20ab6b8ccb5f0359d
child 258253 4d2723bc0bcba1a8d67bfa36719331cdbeeecf0d
push id29249
push userryanvm@gmail.com
push dateWed, 19 Aug 2015 11:17:27 +0000
treeherdermozilla-central@706b23a03d1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel, nical
bugs1195531
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1195531 - Don't discard d3d11 textures when we move the TextureSource to a new compositor. r=jrmuizel,nical
gfx/layers/d3d11/TextureD3D11.cpp
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -739,16 +739,19 @@ DXGITextureHostD3D11::GetDevice()
   return gfxWindowsPlatform::GetPlatform()->GetD3D11Device();
 }
 
 void
 DXGITextureHostD3D11::SetCompositor(Compositor* aCompositor)
 {
   MOZ_ASSERT(aCompositor);
   mCompositor = static_cast<CompositorD3D11*>(aCompositor);
+  if (mTextureSource) {
+    mTextureSource->SetCompositor(aCompositor);
+  }
 }
 
 bool
 DXGITextureHostD3D11::Lock()
 {
   if (!GetDevice()) {
     NS_WARNING("trying to lock a TextureHost without a D3D device");
     return false;
@@ -841,16 +844,19 @@ DXGIYCbCrTextureHostD3D11::GetDevice()
   return gfxWindowsPlatform::GetPlatform()->GetD3D11Device();
 }
 
 void
 DXGIYCbCrTextureHostD3D11::SetCompositor(Compositor* aCompositor)
 {
   MOZ_ASSERT(aCompositor);
   mCompositor = static_cast<CompositorD3D11*>(aCompositor);
+  if (mTextureSources[0]) {
+    mTextureSources[0]->SetCompositor(aCompositor);
+  }
 }
 
 bool
 DXGIYCbCrTextureHostD3D11::Lock()
 {
   if (!GetDevice()) {
     NS_WARNING("trying to lock a TextureHost without a D3D device");
     return false;
@@ -1060,21 +1066,20 @@ DataTextureSourceD3D11::GetTileRect()
   IntRect rect = GetTileRect(mCurrentTile);
   return IntRect(rect.x, rect.y, rect.width, rect.height);
 }
 
 void
 DataTextureSourceD3D11::SetCompositor(Compositor* aCompositor)
 {
   MOZ_ASSERT(aCompositor);
-  CompositorD3D11* d3dCompositor = static_cast<CompositorD3D11*>(aCompositor);
-  if (mCompositor && mCompositor != d3dCompositor) {
-    Reset();
+  mCompositor = static_cast<CompositorD3D11*>(aCompositor);
+  if (mNextSibling) {
+    mNextSibling->SetCompositor(aCompositor);
   }
-  mCompositor = d3dCompositor;
 }
 
 CompositingRenderTargetD3D11::CompositingRenderTargetD3D11(ID3D11Texture2D* aTexture,
                                                            const gfx::IntPoint& aOrigin)
   : CompositingRenderTarget(aOrigin)
 {
   MOZ_ASSERT(aTexture);