mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 715822 - OGL CleanupResources should cleanup Texture resources too. r=mattwoodrow
This commit is contained in:
parent
a01d275bab
commit
23660a956c
@ -68,12 +68,7 @@ void
|
||||
CanvasLayerOGL::Destroy()
|
||||
{
|
||||
if (!mDestroyed) {
|
||||
if (mTexture) {
|
||||
GLContext *cx = mOGLManager->glForResources();
|
||||
cx->MakeCurrent();
|
||||
cx->fDeleteTextures(1, &mTexture);
|
||||
}
|
||||
|
||||
CleanupResources();
|
||||
mDestroyed = true;
|
||||
}
|
||||
}
|
||||
@ -296,6 +291,16 @@ CanvasLayerOGL::RenderLayer(int aPreviousDestination,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
CanvasLayerOGL::CleanupResources()
|
||||
{
|
||||
if (mTexture) {
|
||||
GLContext* cx = mOGLManager->glForResources();
|
||||
cx->MakeCurrent();
|
||||
cx->fDeleteTextures(1, &mTexture);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ShadowCanvasLayerOGL::ShadowCanvasLayerOGL(LayerManagerOGL* aManager)
|
||||
: ShadowCanvasLayer(aManager, nsnull)
|
||||
@ -411,3 +416,9 @@ ShadowCanvasLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
mOGLManager->BindAndDrawQuad(program, mNeedsYFlip); // FIXME flip order of tiles?
|
||||
} while (mTexImage->NextTile());
|
||||
}
|
||||
|
||||
void
|
||||
ShadowCanvasLayerOGL::CleanupResources()
|
||||
{
|
||||
DestroyFrontBuffer();
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
virtual Layer* GetLayer() { return this; }
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
virtual void CleanupResources();
|
||||
|
||||
protected:
|
||||
void UpdateSurface();
|
||||
@ -128,6 +129,7 @@ public:
|
||||
Layer* GetLayer();
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
virtual void CleanupResources();
|
||||
|
||||
private:
|
||||
nsRefPtr<TextureImage> mTexImage;
|
||||
|
@ -65,6 +65,7 @@ public:
|
||||
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
virtual void CleanupResources() {};
|
||||
};
|
||||
|
||||
class ShadowColorLayerOGL : public ShadowColorLayer,
|
||||
@ -86,6 +87,7 @@ public:
|
||||
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
virtual void CleanupResources() {};
|
||||
};
|
||||
|
||||
} /* layers */
|
||||
|
@ -133,6 +133,16 @@ ContainerDestroy(Container* aContainer)
|
||||
}
|
||||
}
|
||||
|
||||
template<class Container>
|
||||
static void
|
||||
ContainerCleanupResources(Container* aContainer)
|
||||
{
|
||||
for (Layer* l = aContainer->GetFirstChild(); l; l = l->GetNextSibling()) {
|
||||
LayerOGL* layerToRender = static_cast<LayerOGL*>(l->ImplData());
|
||||
layerToRender->CleanupResources();
|
||||
}
|
||||
}
|
||||
|
||||
static inline LayerOGL*
|
||||
GetNextSibling(LayerOGL* aLayer)
|
||||
{
|
||||
@ -334,6 +344,11 @@ ContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
ContainerRender(this, aPreviousFrameBuffer, aOffset, mOGLManager);
|
||||
}
|
||||
|
||||
void
|
||||
ContainerLayerOGL::CleanupResources()
|
||||
{
|
||||
ContainerCleanupResources(this);
|
||||
}
|
||||
|
||||
ShadowContainerLayerOGL::ShadowContainerLayerOGL(LayerManagerOGL *aManager)
|
||||
: ShadowContainerLayer(aManager, NULL)
|
||||
@ -381,6 +396,11 @@ ShadowContainerLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
ContainerRender(this, aPreviousFrameBuffer, aOffset, mOGLManager);
|
||||
}
|
||||
|
||||
void
|
||||
ShadowContainerLayerOGL::CleanupResources()
|
||||
{
|
||||
ContainerCleanupResources(this);
|
||||
}
|
||||
|
||||
} /* layers */
|
||||
} /* mozilla */
|
||||
|
@ -96,6 +96,8 @@ public:
|
||||
{
|
||||
DefaultComputeEffectiveTransforms(aTransformToSurface);
|
||||
}
|
||||
|
||||
virtual void CleanupResources();
|
||||
};
|
||||
|
||||
class ShadowContainerLayerOGL : public ShadowContainerLayer,
|
||||
@ -135,6 +137,8 @@ public:
|
||||
{
|
||||
DefaultComputeEffectiveTransforms(aTransformToSurface);
|
||||
}
|
||||
|
||||
virtual void CleanupResources();
|
||||
};
|
||||
|
||||
} /* layers */
|
||||
|
@ -934,7 +934,7 @@ ShadowImageLayerOGL::Destroy()
|
||||
{
|
||||
if (!mDestroyed) {
|
||||
mDestroyed = true;
|
||||
mTexImage = nsnull;
|
||||
CleanupResources();
|
||||
}
|
||||
}
|
||||
|
||||
@ -995,6 +995,11 @@ ShadowImageLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ShadowImageLayerOGL::CleanupResources()
|
||||
{
|
||||
mTexImage = nsnull;
|
||||
}
|
||||
|
||||
} /* layers */
|
||||
} /* mozilla */
|
||||
|
@ -180,6 +180,7 @@ public:
|
||||
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
virtual void CleanupResources() {}
|
||||
};
|
||||
|
||||
class THEBES_API PlanarYCbCrImageOGL : public PlanarYCbCrImage
|
||||
@ -266,6 +267,8 @@ public:
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
|
||||
virtual void CleanupResources();
|
||||
|
||||
private:
|
||||
bool Init(const SharedImage& aFront);
|
||||
|
||||
|
@ -120,6 +120,10 @@ LayerManagerOGL::CleanupResources()
|
||||
if (!mGLContext)
|
||||
return;
|
||||
|
||||
if (mRoot) {
|
||||
RootLayer()->CleanupResources();
|
||||
}
|
||||
|
||||
nsRefPtr<GLContext> ctx = mGLContext->GetSharedContext();
|
||||
if (!ctx) {
|
||||
ctx = mGLContext;
|
||||
|
@ -539,6 +539,7 @@ public:
|
||||
|
||||
LayerManagerOGL* OGLManager() const { return mOGLManager; }
|
||||
GLContext *gl() const { return mOGLManager->gl(); }
|
||||
virtual void CleanupResources() = 0;
|
||||
|
||||
protected:
|
||||
LayerManagerOGL *mOGLManager;
|
||||
|
@ -819,6 +819,11 @@ ThebesLayerOGL::IsEmpty()
|
||||
return !mBuffer;
|
||||
}
|
||||
|
||||
void
|
||||
ThebesLayerOGL::CleanupResources()
|
||||
{
|
||||
mBuffer = nsnull;
|
||||
}
|
||||
|
||||
class ShadowBufferOGL : public ThebesLayerBufferOGL
|
||||
{
|
||||
@ -965,5 +970,11 @@ ShadowThebesLayerOGL::RenderLayer(int aPreviousFrameBuffer,
|
||||
mBuffer->RenderTo(aOffset, mOGLManager, 0);
|
||||
}
|
||||
|
||||
void
|
||||
ShadowThebesLayerOGL::CleanupResources()
|
||||
{
|
||||
DestroyFrontBuffer();
|
||||
}
|
||||
|
||||
} /* layers */
|
||||
} /* mozilla */
|
||||
|
@ -75,6 +75,7 @@ public:
|
||||
virtual bool IsEmpty();
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
virtual void CleanupResources();
|
||||
|
||||
private:
|
||||
friend class BasicBufferOGL;
|
||||
@ -105,6 +106,7 @@ public:
|
||||
virtual bool IsEmpty();
|
||||
virtual void RenderLayer(int aPreviousFrameBuffer,
|
||||
const nsIntPoint& aOffset);
|
||||
virtual void CleanupResources();
|
||||
|
||||
private:
|
||||
nsRefPtr<ShadowBufferOGL> mBuffer;
|
||||
|
Loading…
Reference in New Issue
Block a user