Bug 1478754 - WebGL crash when webgl.enable-surface-texture is enabled on Android; r=jgilbert,rbarker

MozReview-Commit-ID: GBTvZiLspvP
This commit is contained in:
Imanol Fernandez
2018-07-28 12:33:55 +02:00
parent a0071ab711
commit a8c39f6eea
4 changed files with 16 additions and 0 deletions

View File

@@ -132,6 +132,10 @@ public:
// even when its buffer is still being used.
virtual void WaitForBufferOwnership() {}
// Returns true if the buffer is available.
// You can call WaitForBufferOwnership to wait for availability.
virtual bool IsBufferAvailable() const { return true; }
// For use when AttachType is correct.
virtual GLenum ProdTextureTarget() const {
MOZ_ASSERT(mAttachType == AttachmentType::GLTexture);

View File

@@ -272,6 +272,11 @@ SharedSurface_SurfaceTexture::WaitForBufferOwnership()
mSurface->SetAvailable(true);
}
bool
SharedSurface_SurfaceTexture::IsBufferAvailable() const {
return mSurface->GetAvailable();
}
bool
SharedSurface_SurfaceTexture::ToSurfaceDescriptor(layers::SurfaceDescriptor* const out_descriptor)
{

View File

@@ -174,6 +174,8 @@ public:
virtual void Commit() override;
virtual void WaitForBufferOwnership() override;
virtual bool IsBufferAvailable() const override;
};

View File

@@ -429,6 +429,11 @@ CanvasClientSharedSurface::UpdateRenderer(gfx::IntSize aSize, Renderer& aRendere
SharedSurface* surf = mShSurfClient->Surf();
if (!surf->IsBufferAvailable()) {
NS_WARNING("SharedSurface buffer not available, skip update");
return;
}
// Readback if needed.
mReadbackClient = nullptr;