Bug 1194472 - Correctly fetch compositor backend in WebGLContext. r=jgilbert

This commit is contained in:
Andrew Comminos 2015-08-17 15:10:12 -07:00
parent 4807763cdd
commit e193dc2524
2 changed files with 17 additions and 2 deletions

View File

@ -672,6 +672,7 @@ PopulateCapFallbackQueue(const SurfaceCaps& baseCaps,
static bool
CreateOffscreen(GLContext* gl, const WebGLContextOptions& options,
const nsCOMPtr<nsIGfxInfo>& gfxInfo, WebGLContext* webgl,
layers::LayersBackend layersBackend,
layers::ISurfaceAllocator* surfAllocator)
{
SurfaceCaps baseCaps;
@ -689,7 +690,7 @@ CreateOffscreen(GLContext* gl, const WebGLContextOptions& options,
if (gl->IsANGLE() ||
(gl->GetContextType() == GLContextType::GLX &&
gfxPlatform::GetPlatform()->GetCompositorBackend() == LayersBackend::LAYERS_OPENGL))
layersBackend == LayersBackend::LAYERS_OPENGL))
{
// We can't use no-alpha formats on ANGLE yet because of:
// https://code.google.com/p/angleproject/issues/detail?id=764
@ -763,7 +764,8 @@ WebGLContext::CreateOffscreenGL(bool forceEnabled)
if (!gl)
break;
if (!CreateOffscreen(gl, mOptions, gfxInfo, this, surfAllocator))
if (!CreateOffscreen(gl, mOptions, gfxInfo, this,
GetCompositorBackendType(), surfAllocator))
break;
if (!InitAndValidateGL())
@ -1292,6 +1294,17 @@ WebGLContext::GetCanvasLayer(nsDisplayListBuilder* builder,
return canvasLayer.forget();
}
layers::LayersBackend
WebGLContext::GetCompositorBackendType() const
{
nsIWidget* docWidget = nsContentUtils::WidgetForDocument(mCanvasElement->OwnerDoc());
if (docWidget) {
layers::LayerManager* layerManager = docWidget->GetLayerManager();
return layerManager->GetCompositorBackendType();
}
return LayersBackend::LAYERS_NONE;
}
void
WebGLContext::GetContextAttributes(dom::Nullable<dom::WebGLContextAttributes>& retval)
{

View File

@ -363,6 +363,8 @@ public:
return IsContextLost() ? 0 : mHeight;
}
layers::LayersBackend GetCompositorBackendType() const;
void
GetContextAttributes(dom::Nullable<dom::WebGLContextAttributes>& retval);