Bug 1187464 - Part 2. RTTI for TextureSource debug purposes. r=botond
☠☠ backed out by 97f319b10c21 ☠ ☠
authorMilan Sreckovic <milan@mozilla.com>
Tue, 02 Feb 2016 11:06:00 +0100
changeset 282863 0cee3cdcce999005de31fabfb4841ac70d534b98
parent 282862 63e2a056311a04e1275d5e8d7ecb439c19b641b8
child 282864 b64710d45b2852b6f082411e6a066497aad50182
push id29972
push usercbook@mozilla.com
push dateThu, 04 Feb 2016 11:02:19 +0000
treeherdermozilla-central@f53533d9eb77 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1187464
milestone47.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 1187464 - Part 2. RTTI for TextureSource debug purposes. r=botond
gfx/layers/basic/BasicCompositor.cpp
gfx/layers/basic/BasicCompositor.h
gfx/layers/basic/MacIOSurfaceTextureHostBasic.h
gfx/layers/basic/X11BasicCompositor.h
gfx/layers/basic/X11TextureSourceBasic.h
gfx/layers/composite/TextureHost.cpp
gfx/layers/composite/TextureHost.h
gfx/layers/composite/X11TextureHost.h
gfx/layers/d3d11/TextureD3D11.h
gfx/layers/d3d9/TextureD3D9.h
gfx/layers/opengl/CompositingRenderTargetOGL.h
gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
gfx/layers/opengl/TextureHostOGL.h
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -29,16 +29,17 @@ namespace mozilla {
 using namespace mozilla::gfx;
 
 namespace layers {
 
 class DataTextureSourceBasic : public DataTextureSource
                              , public TextureSourceBasic
 {
 public:
+  virtual const char* Name() const override { return "DataTextureSourceBasic"; }
 
   virtual TextureSourceBasic* AsSourceBasic() override { return this; }
 
   virtual gfx::SourceSurface* GetSurface(DrawTarget* aTarget) override { return mSurface; }
 
   SurfaceFormat GetFormat() const override
   {
     return mSurface->GetFormat();
@@ -446,17 +447,17 @@ BasicCompositor::DrawQuad(const gfx::Rec
 
           DrawSurfaceWithTextureCoords(dest, aRect,
                                        premultData,
                                        texturedEffect->mTextureCoords,
                                        texturedEffect->mFilter,
                                        DrawOptions(aOpacity, blendMode),
                                        sourceMask, &maskTransform);
       } else {
-        gfxDevCrash(LogReason::IncompatibleBasicTexturedEffect) << "Bad for basic";
+        gfxDevCrash(LogReason::IncompatibleBasicTexturedEffect) << "Bad for basic with " << texturedEffect->mTexture->Name();
       }
 
       break;
     }
     case EffectTypes::YCBCR: {
       NS_RUNTIMEABORT("Can't (easily) support component alpha with BasicCompositor!");
       break;
     }
--- a/gfx/layers/basic/BasicCompositor.h
+++ b/gfx/layers/basic/BasicCompositor.h
@@ -18,16 +18,18 @@ class BasicCompositingRenderTarget : pub
 {
 public:
   BasicCompositingRenderTarget(gfx::DrawTarget* aDrawTarget, const gfx::IntRect& aRect)
     : CompositingRenderTarget(aRect.TopLeft())
     , mDrawTarget(aDrawTarget)
     , mSize(aRect.Size())
   { }
 
+  virtual const char* Name() const override { return "BasicCompositingRenderTarget"; }
+
   virtual gfx::IntSize GetSize() const override { return mSize; }
 
   void BindRenderTarget();
 
   virtual gfx::SurfaceFormat GetFormat() const override
   {
     return mDrawTarget ? mDrawTarget->GetFormat()
                        : gfx::SurfaceFormat(gfx::SurfaceFormat::UNKNOWN);
--- a/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h
+++ b/gfx/layers/basic/MacIOSurfaceTextureHostBasic.h
@@ -26,16 +26,18 @@ class MacIOSurfaceTextureSourceBasic
   : public TextureSourceBasic,
     public TextureSource
 {
 public:
   MacIOSurfaceTextureSourceBasic(BasicCompositor* aCompositor,
                                  MacIOSurface* aSurface);
   virtual ~MacIOSurfaceTextureSourceBasic();
 
+  virtual const char* Name() const override { return "MacIOSurfaceTextureSourceBasic"; }
+
   virtual TextureSourceBasic* AsSourceBasic() override { return this; }
 
   virtual gfx::IntSize GetSize() const override;
   virtual gfx::SurfaceFormat GetFormat() const override;
   virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override;
 
   virtual void DeallocateDeviceData() override { }
 
--- a/gfx/layers/basic/X11BasicCompositor.h
+++ b/gfx/layers/basic/X11BasicCompositor.h
@@ -17,16 +17,18 @@ namespace layers {
 
 // TextureSource for Image-backed surfaces.
 class X11DataTextureSourceBasic : public DataTextureSource
                                 , public TextureSourceBasic
 {
 public:
   X11DataTextureSourceBasic() {};
 
+  virtual const char* Name() const override { return "X11DataTextureSourceBasic"; }
+
   virtual bool Update(gfx::DataSourceSurface* aSurface,
                       nsIntRegion* aDestRegion = nullptr,
                       gfx::IntPoint* aSrcOffset = nullptr) override;
 
   virtual TextureSourceBasic* AsSourceBasic() override;
 
   virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override;
 
--- a/gfx/layers/basic/X11TextureSourceBasic.h
+++ b/gfx/layers/basic/X11TextureSourceBasic.h
@@ -19,16 +19,18 @@ class BasicCompositor;
 // TextureSource for Xlib-backed surfaces.
 class X11TextureSourceBasic
   : public TextureSourceBasic
   , public X11TextureSource
 {
 public:
   X11TextureSourceBasic(BasicCompositor* aCompositor, gfxXlibSurface* aSurface);
 
+  virtual const char* Name() const override { return "X11TextureSourceBasic"; }
+
   virtual X11TextureSourceBasic* AsSourceBasic() override { return this; }
 
   virtual gfx::IntSize GetSize() const override;
 
   virtual gfx::SurfaceFormat GetFormat() const override;
 
   virtual gfx::SourceSurface* GetSurface(gfx::DrawTarget* aTarget) override;
 
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -369,16 +369,23 @@ TextureSource::TextureSource()
     MOZ_COUNT_CTOR(TextureSource);
 }
 
 TextureSource::~TextureSource()
 {
     MOZ_COUNT_DTOR(TextureSource);
 }
 
+const char*
+TextureSource::Name() const
+{
+  MOZ_CRASH("TextureSource without class name");
+  return "TextureSource";
+}
+  
 BufferTextureHost::BufferTextureHost(const BufferDescriptor& aDesc,
                                      TextureFlags aFlags)
 : TextureHost(aFlags)
 , mCompositor(nullptr)
 , mUpdateSerial(1)
 , mLocked(false)
 , mNeedsFullUpdate(false)
 {
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -83,16 +83,18 @@ class TextureSource: public RefCounted<T
 {
 public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(TextureSource)
 
   TextureSource();
 
   virtual ~TextureSource();
 
+  virtual const char* Name() const = 0;
+
   /**
    * Should be overridden in order to deallocate the data that is associated
    * with the rendering backend, such as GL textures.
    */
   virtual void DeallocateDeviceData() {}
 
 
   /**
@@ -228,16 +230,18 @@ typedef CompositableTextureRef<TextureHo
  */
 class DataTextureSource : public TextureSource
 {
 public:
   DataTextureSource()
     : mUpdateSerial(0)
   {}
 
+  virtual const char* Name() const override { return "DataTextureSource"; }
+
   virtual DataTextureSource* AsDataTextureSource() override { return this; }
 
   /**
    * Upload a (portion of) surface to the TextureSource.
    *
    * The DataTextureSource doesn't own aSurface, although it owns and manage
    * the device texture it uploads to internally.
    */
@@ -719,16 +723,18 @@ public:
 
   explicit CompositingRenderTarget(const gfx::IntPoint& aOrigin)
     : mClearOnBind(false)
     , mOrigin(aOrigin)
     , mHasComplexProjection(false)
   {}
   virtual ~CompositingRenderTarget() {}
 
+  virtual const char* Name() const override { return "CompositingRenderTarget"; }
+
 #ifdef MOZ_DUMP_PAINTING
   virtual already_AddRefed<gfx::DataSourceSurface> Dump(Compositor* aCompositor) { return nullptr; }
 #endif
 
   /**
    * Perform a clear when recycling a non opaque surface.
    * The clear is deferred to when the render target is bound.
    */
--- a/gfx/layers/composite/X11TextureHost.h
+++ b/gfx/layers/composite/X11TextureHost.h
@@ -16,16 +16,18 @@ namespace mozilla {
 namespace layers {
 
 class X11TextureSource : public TextureSource
 {
 public:
   // Called when the underlying X surface has been changed.
   // Useful for determining whether to rebind a GLXPixmap to a texture.
   virtual void Updated() = 0;
+
+  virtual const char* Name() const override { return "X11TextureSource"; }
 };
 
 // TextureHost for Xlib-backed TextureSources.
 class X11TextureHost : public TextureHost
 {
 public:
   X11TextureHost(TextureFlags aFlags,
                  const SurfaceDescriptorX11& aDescriptor);
--- a/gfx/layers/d3d11/TextureD3D11.h
+++ b/gfx/layers/d3d11/TextureD3D11.h
@@ -248,16 +248,17 @@ public:
   DataTextureSourceD3D11(gfx::SurfaceFormat aFormat, CompositorD3D11* aCompositor,
                          TextureFlags aFlags);
 
   DataTextureSourceD3D11(gfx::SurfaceFormat aFormat, CompositorD3D11* aCompositor,
                          ID3D11Texture2D* aTexture);
 
   virtual ~DataTextureSourceD3D11();
 
+  virtual const char* Name() const override { return "DataTextureSourceD3D11"; }
 
   // DataTextureSource
 
   virtual bool Update(gfx::DataSourceSurface* aSurface,
                       nsIntRegion* aDestRegion = nullptr,
                       gfx::IntPoint* aSrcOffset = nullptr) override;
 
   // TextureSource
@@ -403,16 +404,18 @@ protected:
 class CompositingRenderTargetD3D11 : public CompositingRenderTarget,
                                      public TextureSourceD3D11
 {
 public:
   CompositingRenderTargetD3D11(ID3D11Texture2D* aTexture,
                                const gfx::IntPoint& aOrigin,
                                DXGI_FORMAT aFormatOverride = DXGI_FORMAT_UNKNOWN);
 
+  virtual const char* Name() const override { return "CompositingRenderTargetD3D11"; }
+
   virtual TextureSourceD3D11* AsSourceD3D11() override { return this; }
 
   void BindRenderTarget(ID3D11DeviceContext* aContext);
 
   virtual gfx::IntSize GetSize() const override;
 
   void SetSize(const gfx::IntSize& aSize) { mSize = aSize; }
 
--- a/gfx/layers/d3d9/TextureD3D9.h
+++ b/gfx/layers/d3d9/TextureD3D9.h
@@ -107,16 +107,18 @@ public:
   DataTextureSourceD3D9(gfx::SurfaceFormat aFormat,
                         gfx::IntSize aSize,
                         CompositorD3D9* aCompositor,
                         IDirect3DTexture9* aTexture,
                         TextureFlags aFlags = TextureFlags::DEFAULT);
 
   virtual ~DataTextureSourceD3D9();
 
+  virtual const char* Name() const override { return "DataTextureSourceD3D9"; }
+
   // DataTextureSource
 
   virtual bool Update(gfx::DataSourceSurface* aSurface,
                       nsIntRegion* aDestRegion = nullptr,
                       gfx::IntPoint* aSrcOffset = nullptr) override;
 
   // TextureSource
 
@@ -393,16 +395,18 @@ public:
                               SurfaceInitMode aInit,
                               const gfx::IntRect& aRect);
   // use for rendering to the main window, cannot be rendered as a texture
   CompositingRenderTargetD3D9(IDirect3DSurface9* aSurface,
                               SurfaceInitMode aInit,
                               const gfx::IntRect& aRect);
   virtual ~CompositingRenderTargetD3D9();
 
+  virtual const char* Name() const override { return "CompositingRenderTargetD3D9"; }
+
   virtual TextureSourceD3D9* AsSourceD3D9() override
   {
     MOZ_ASSERT(mTexture,
                "No texture, can't be indirectly rendered. Is this the screen backbuffer?");
     return this;
   }
 
   virtual gfx::IntSize GetSize() const override;
--- a/gfx/layers/opengl/CompositingRenderTargetOGL.h
+++ b/gfx/layers/opengl/CompositingRenderTargetOGL.h
@@ -72,16 +72,18 @@ public:
     , mCompositor(aCompositor)
     , mGL(aCompositor->gl())
     , mTextureHandle(aTexure)
     , mFBO(aFBO)
   {}
 
   ~CompositingRenderTargetOGL();
 
+  virtual const char* Name() const override { return "CompositingRenderTargetOGL"; }
+
   /**
    * Create a render target around the default FBO, for rendering straight to
    * the window.
    */
   static already_AddRefed<CompositingRenderTargetOGL>
   RenderTargetForWindow(CompositorOGL* aCompositor,
                         const gfx::IntSize& aSize)
   {
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.h
@@ -23,16 +23,18 @@ namespace layers {
 class MacIOSurfaceTextureSourceOGL : public TextureSource
                                    , public TextureSourceOGL
 {
 public:
   MacIOSurfaceTextureSourceOGL(CompositorOGL* aCompositor,
                                MacIOSurface* aSurface);
   virtual ~MacIOSurfaceTextureSourceOGL();
 
+  virtual const char* Name() const override { return "MacIOSurfaceTextureSourceOGL"; }
+
   virtual TextureSourceOGL* AsSourceOGL() override { return this; }
 
   virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) override;
 
   virtual bool IsValid() const override { return !!gl(); }
 
   virtual gfx::IntSize GetSize() const override;
 
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -137,16 +137,17 @@ class TextureImageTextureSourceOGL final
 public:
   explicit TextureImageTextureSourceOGL(CompositorOGL *aCompositor,
                                         TextureFlags aFlags = TextureFlags::DEFAULT)
     : mCompositor(aCompositor)
     , mFlags(aFlags)
     , mIterating(false)
   {}
 
+  virtual const char* Name() const override { return "TextureImageTextureSourceOGL"; }
   // DataTextureSource
 
   virtual bool Update(gfx::DataSourceSurface* aSurface,
                       nsIntRegion* aDestRegion = nullptr,
                       gfx::IntPoint* aSrcOffset = nullptr) override;
 
   void EnsureBuffer(const gfx::IntSize& aSize,
                     gfxContentType aContentType);
@@ -232,16 +233,18 @@ public:
                   GLuint aTextureHandle,
                   GLenum aTarget,
                   gfx::IntSize aSize,
                   gfx::SurfaceFormat aFormat,
                   bool aExternallyOwned = false);
 
   ~GLTextureSource();
 
+  virtual const char* Name() const override { return "GLTextureSource"; }
+
   virtual GLTextureSource* AsGLTextureSource() override { return this; }
 
   virtual TextureSourceOGL* AsSourceOGL() override { return this; }
 
   virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) override;
 
   virtual bool IsValid() const override;
 
@@ -339,16 +342,18 @@ class SurfaceTextureSource : public Text
 public:
   SurfaceTextureSource(CompositorOGL* aCompositor,
                        mozilla::gl::AndroidSurfaceTexture* aSurfTex,
                        gfx::SurfaceFormat aFormat,
                        GLenum aTarget,
                        GLenum aWrapMode,
                        gfx::IntSize aSize);
 
+  virtual const char* Name() const override { return "SurfaceTextureSource"; }
+
   virtual TextureSourceOGL* AsSourceOGL() { return this; }
 
   virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) override;
 
   virtual bool IsValid() const override;
 
   virtual gfx::IntSize GetSize() const override { return mSize; }
 
@@ -431,16 +436,18 @@ class EGLImageTextureSource : public Tex
 public:
   EGLImageTextureSource(CompositorOGL* aCompositor,
                         EGLImage aImage,
                         gfx::SurfaceFormat aFormat,
                         GLenum aTarget,
                         GLenum aWrapMode,
                         gfx::IntSize aSize);
 
+  virtual const char* Name() const override { return "EGLImageTextureSource"; }
+
   virtual TextureSourceOGL* AsSourceOGL() override { return this; }
 
   virtual void BindTexture(GLenum activetex, gfx::Filter aFilter) override;
 
   virtual bool IsValid() const override;
 
   virtual gfx::IntSize GetSize() const override { return mSize; }