gecko-dev/gfx/gl/GLContextProviderNull.cpp
sotaro 2c65d7229c Bug 1532949 - Bug 1532024 - Explicityly create headless context for webrender in RenderCompositorEGL r=jgilbert
On Wayland with WebRender, RenderCompositorEGL creates headless context by using GLContextProviderEGL::CreateForCompositorWidget(), since GetNativeData(NS_NATIVE_EGL_WINDOW) returns nullptr. But we want to make hadless explicitly. But GLContextProviderEGL::CreateHeadless() and GLContextEGL::CreateEGLPBufferOffscreenContext() could not be used for it. They creates incompatible EGLConfig to egl window. Then we extends GLContextProviderEAGL::CreateForCompositorWidget() to handle this case. When CreateForCompositorWidget() receives null widget, it creates GLContext without surface of egl window.

Differential Revision: https://phabricator.services.mozilla.com/D22454

--HG--
extra : moz-landing-system : lando
2019-03-13 00:17:01 +00:00

48 lines
1.4 KiB
C++

/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "GLContextProvider.h"
namespace mozilla {
namespace gl {
using namespace mozilla::widget;
already_AddRefed<GLContext> GLContextProviderNull::CreateForCompositorWidget(
CompositorWidget* aCompositorWidget, bool aWebRender,
bool aForceAccelerated) {
return nullptr;
}
already_AddRefed<GLContext> GLContextProviderNull::CreateForWindow(
nsIWidget* aWidget, bool aWebRender, bool aForceAccelerated) {
return nullptr;
}
already_AddRefed<GLContext> GLContextProviderNull::CreateWrappingExisting(
void*, void*) {
return nullptr;
}
already_AddRefed<GLContext> GLContextProviderNull::CreateOffscreen(
const gfx::IntSize&, const SurfaceCaps&, CreateContextFlags,
nsACString* const out_failureId) {
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_NULL");
return nullptr;
}
already_AddRefed<GLContext> GLContextProviderNull::CreateHeadless(
CreateContextFlags, nsACString* const out_failureId) {
*out_failureId = NS_LITERAL_CSTRING("FEATURE_FAILURE_NULL");
return nullptr;
}
GLContext* GLContextProviderNull::GetGlobalContext() { return nullptr; }
void GLContextProviderNull::Shutdown() {}
} /* namespace gl */
} /* namespace mozilla */