Bug 1150944 - Add a flags parameter to GLContextProvider functions instead of a bool. r=jgilbert
This commit is contained in:
@@ -539,10 +539,10 @@ HasAcceleratedLayers(const nsCOMPtr<nsIGfxInfo>& gfxInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static already_AddRefed<GLContext>
|
static already_AddRefed<GLContext>
|
||||||
CreateHeadlessNativeGL(bool forceEnabled, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
CreateHeadlessNativeGL(CreateContextFlags flags, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
||||||
bool requireCompatProfile, WebGLContext* webgl)
|
WebGLContext* webgl)
|
||||||
{
|
{
|
||||||
if (!forceEnabled &&
|
if (!(flags & CreateContextFlags::FORCE_ENABLE_HARDWARE) &&
|
||||||
IsFeatureInBlacklist(gfxInfo, nsIGfxInfo::FEATURE_WEBGL_OPENGL))
|
IsFeatureInBlacklist(gfxInfo, nsIGfxInfo::FEATURE_WEBGL_OPENGL))
|
||||||
{
|
{
|
||||||
webgl->GenerateWarning("Refused to create native OpenGL context"
|
webgl->GenerateWarning("Refused to create native OpenGL context"
|
||||||
@@ -550,7 +550,7 @@ CreateHeadlessNativeGL(bool forceEnabled, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<GLContext> gl = gl::GLContextProvider::CreateHeadless(requireCompatProfile);
|
nsRefPtr<GLContext> gl = gl::GLContextProvider::CreateHeadless(flags);
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
webgl->GenerateWarning("Error during native OpenGL init.");
|
webgl->GenerateWarning("Error during native OpenGL init.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -564,8 +564,8 @@ CreateHeadlessNativeGL(bool forceEnabled, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
|||||||
// right now, we get ANGLE implicitly by using EGL on Windows.
|
// right now, we get ANGLE implicitly by using EGL on Windows.
|
||||||
// Eventually, we want to be able to pick ANGLE-EGL or native EGL.
|
// Eventually, we want to be able to pick ANGLE-EGL or native EGL.
|
||||||
static already_AddRefed<GLContext>
|
static already_AddRefed<GLContext>
|
||||||
CreateHeadlessANGLE(bool forceEnabled, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
CreateHeadlessANGLE(CreateContextFlags flags, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
||||||
bool requireCompatProfile, WebGLContext* webgl)
|
WebGLContext* webgl)
|
||||||
{
|
{
|
||||||
nsRefPtr<GLContext> gl;
|
nsRefPtr<GLContext> gl;
|
||||||
|
|
||||||
@@ -583,13 +583,12 @@ CreateHeadlessANGLE(bool forceEnabled, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static already_AddRefed<GLContext>
|
static already_AddRefed<GLContext>
|
||||||
CreateHeadlessEGL(bool forceEnabled, bool requireCompatProfile,
|
CreateHeadlessEGL(CreateContextFlags flags, WebGLContext* webgl)
|
||||||
WebGLContext* webgl)
|
|
||||||
{
|
{
|
||||||
nsRefPtr<GLContext> gl;
|
nsRefPtr<GLContext> gl;
|
||||||
|
|
||||||
#ifdef ANDROID
|
#ifdef ANDROID
|
||||||
gl = gl::GLContextProviderEGL::CreateHeadless(requireCompatProfile);
|
gl = gl::GLContextProviderEGL::CreateHeadless(flags);
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
webgl->GenerateWarning("Error during EGL OpenGL init.");
|
webgl->GenerateWarning("Error during EGL OpenGL init.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -601,7 +600,7 @@ CreateHeadlessEGL(bool forceEnabled, bool requireCompatProfile,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static already_AddRefed<GLContext>
|
static already_AddRefed<GLContext>
|
||||||
CreateHeadlessGL(bool forceEnabled, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
CreateHeadlessGL(CreateContextFlags flags, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
||||||
WebGLContext* webgl)
|
WebGLContext* webgl)
|
||||||
{
|
{
|
||||||
bool preferEGL = PR_GetEnv("MOZ_WEBGL_PREFER_EGL");
|
bool preferEGL = PR_GetEnv("MOZ_WEBGL_PREFER_EGL");
|
||||||
@@ -610,21 +609,21 @@ CreateHeadlessGL(bool forceEnabled, const nsCOMPtr<nsIGfxInfo>& gfxInfo,
|
|||||||
if (PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL"))
|
if (PR_GetEnv("MOZ_WEBGL_FORCE_OPENGL"))
|
||||||
disableANGLE = true;
|
disableANGLE = true;
|
||||||
|
|
||||||
bool requireCompatProfile = webgl->IsWebGL2() ? false : true;
|
if (!webgl->IsWebGL2()) {
|
||||||
|
flags |= CreateContextFlags::REQUIRE_COMPAT_PROFILE;
|
||||||
|
}
|
||||||
|
|
||||||
nsRefPtr<GLContext> gl;
|
nsRefPtr<GLContext> gl;
|
||||||
|
|
||||||
if (preferEGL)
|
if (preferEGL)
|
||||||
gl = CreateHeadlessEGL(forceEnabled, requireCompatProfile, webgl);
|
gl = CreateHeadlessEGL(flags, webgl);
|
||||||
|
|
||||||
if (!gl && !disableANGLE) {
|
if (!gl && !disableANGLE) {
|
||||||
gl = CreateHeadlessANGLE(forceEnabled, gfxInfo, requireCompatProfile,
|
gl = CreateHeadlessANGLE(flags, gfxInfo, webgl);
|
||||||
webgl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
gl = CreateHeadlessNativeGL(forceEnabled, gfxInfo,
|
gl = CreateHeadlessNativeGL(flags, gfxInfo, webgl);
|
||||||
requireCompatProfile, webgl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return gl.forget();
|
return gl.forget();
|
||||||
@@ -749,7 +748,10 @@ WebGLContext::CreateOffscreenGL(bool forceEnabled)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
gl = CreateHeadlessGL(forceEnabled, gfxInfo, this);
|
CreateContextFlags flags = forceEnabled ? CreateContextFlags::FORCE_ENABLE_HARDWARE :
|
||||||
|
CreateContextFlags::NONE;
|
||||||
|
|
||||||
|
gl = CreateHeadlessGL(flags, gfxInfo, this);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (!gl)
|
if (!gl)
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ protected:
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
mGLContext = GLContextProvider::CreateHeadless(false);
|
mGLContext = GLContextProvider::CreateHeadless(CreateContextFlags::NONE);
|
||||||
return mGLContext;
|
return mGLContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -92,8 +92,7 @@ static nsRefPtr<GLContext> sPluginContext = nullptr;
|
|||||||
static bool EnsureGLContext()
|
static bool EnsureGLContext()
|
||||||
{
|
{
|
||||||
if (!sPluginContext) {
|
if (!sPluginContext) {
|
||||||
bool requireCompatProfile = true;
|
sPluginContext = GLContextProvider::CreateHeadless(CreateContextFlags::REQUIRE_COMPAT_PROFILE);
|
||||||
sPluginContext = GLContextProvider::CreateHeadless(requireCompatProfile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return sPluginContext != nullptr;
|
return sPluginContext != nullptr;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
#include "GLContextTypes.h"
|
#include "GLContextTypes.h"
|
||||||
#include "nsAutoPtr.h"
|
#include "nsAutoPtr.h"
|
||||||
#include "SurfaceTypes.h"
|
#include "SurfaceTypes.h"
|
||||||
|
#include "mozilla/TypedEnumBits.h"
|
||||||
|
|
||||||
#include "nsSize.h" // for gfx::IntSize (needed by GLContextProviderImpl.h below)
|
#include "nsSize.h" // for gfx::IntSize (needed by GLContextProviderImpl.h below)
|
||||||
|
|
||||||
@@ -17,6 +18,14 @@ class nsIWidget;
|
|||||||
namespace mozilla {
|
namespace mozilla {
|
||||||
namespace gl {
|
namespace gl {
|
||||||
|
|
||||||
|
enum class CreateContextFlags : int8_t {
|
||||||
|
NONE = 0,
|
||||||
|
REQUIRE_COMPAT_PROFILE = 1 << 0,
|
||||||
|
// Force the use of hardware backed GL, don't allow software implementations.
|
||||||
|
FORCE_ENABLE_HARDWARE = 1 << 1,
|
||||||
|
};
|
||||||
|
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CreateContextFlags)
|
||||||
|
|
||||||
#define IN_GL_CONTEXT_PROVIDER_H
|
#define IN_GL_CONTEXT_PROVIDER_H
|
||||||
|
|
||||||
// Null is always there
|
// Null is always there
|
||||||
|
|||||||
@@ -253,7 +253,7 @@ GLContextProviderCGL::CreateForWindow(nsIWidget *aWidget)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static already_AddRefed<GLContextCGL>
|
static already_AddRefed<GLContextCGL>
|
||||||
CreateOffscreenFBOContext(bool requireCompatProfile)
|
CreateOffscreenFBOContext(CreateContextFlags flags)
|
||||||
{
|
{
|
||||||
if (!sCGLLibrary.EnsureInitialized()) {
|
if (!sCGLLibrary.EnsureInitialized()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -262,7 +262,7 @@ CreateOffscreenFBOContext(bool requireCompatProfile)
|
|||||||
ContextProfile profile;
|
ContextProfile profile;
|
||||||
NSOpenGLContext* context = nullptr;
|
NSOpenGLContext* context = nullptr;
|
||||||
|
|
||||||
if (!requireCompatProfile) {
|
if (!(flags & CreateContextFlags::REQUIRE_COMPAT_PROFILE)) {
|
||||||
profile = ContextProfile::OpenGLCore;
|
profile = ContextProfile::OpenGLCore;
|
||||||
context = CreateWithFormat(kAttribs_offscreen_coreProfile);
|
context = CreateWithFormat(kAttribs_offscreen_coreProfile);
|
||||||
}
|
}
|
||||||
@@ -287,10 +287,10 @@ CreateOffscreenFBOContext(bool requireCompatProfile)
|
|||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderCGL::CreateHeadless(bool requireCompatProfile, bool forceEnabled)
|
GLContextProviderCGL::CreateHeadless(CreateContextFlags flags)
|
||||||
{
|
{
|
||||||
nsRefPtr<GLContextCGL> gl;
|
nsRefPtr<GLContextCGL> gl;
|
||||||
gl = CreateOffscreenFBOContext(requireCompatProfile);
|
gl = CreateOffscreenFBOContext(flags);
|
||||||
if (!gl)
|
if (!gl)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
@@ -305,9 +305,9 @@ GLContextProviderCGL::CreateHeadless(bool requireCompatProfile, bool forceEnable
|
|||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderCGL::CreateOffscreen(const IntSize& size,
|
GLContextProviderCGL::CreateOffscreen(const IntSize& size,
|
||||||
const SurfaceCaps& caps,
|
const SurfaceCaps& caps,
|
||||||
bool requireCompatProfile)
|
CreateContextFlags flags)
|
||||||
{
|
{
|
||||||
nsRefPtr<GLContext> glContext = CreateHeadless(requireCompatProfile);
|
nsRefPtr<GLContext> glContext = CreateHeadless(flags);
|
||||||
if (!glContext->InitOffscreen(size, caps)) {
|
if (!glContext->InitOffscreen(size, caps)) {
|
||||||
NS_WARNING("Failed during InitOffscreen.");
|
NS_WARNING("Failed during InitOffscreen.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -330,7 +330,7 @@ GLContextProviderCGL::GetGlobalContext()
|
|||||||
// than 16x16 in size; also 16x16 is POT so that we can do
|
// than 16x16 in size; also 16x16 is POT so that we can do
|
||||||
// a FBO with it on older video cards. A FBO context for
|
// a FBO with it on older video cards. A FBO context for
|
||||||
// sharing is preferred since it has no associated target.
|
// sharing is preferred since it has no associated target.
|
||||||
gGlobalContext = CreateOffscreenFBOContext(false);
|
gGlobalContext = CreateOffscreenFBOContext(CreateContextFlags::NONE);
|
||||||
if (!gGlobalContext || !static_cast<GLContextCGL*>(gGlobalContext.get())->Init()) {
|
if (!gGlobalContext || !static_cast<GLContextCGL*>(gGlobalContext.get())->Init()) {
|
||||||
NS_WARNING("Couldn't init gGlobalContext.");
|
NS_WARNING("Couldn't init gGlobalContext.");
|
||||||
gGlobalContext = nullptr;
|
gGlobalContext = nullptr;
|
||||||
|
|||||||
@@ -933,9 +933,9 @@ GLContextEGL::CreateEGLPixmapOffscreenContext(const mozilla::gfx::IntSize& size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderEGL::CreateHeadless(bool requireCompatProfile, bool forceEnabled)
|
GLContextProviderEGL::CreateHeadless(CreateContextFlags flags)
|
||||||
{
|
{
|
||||||
if (!sEGLLibrary.EnsureInitialized(forceEnabled)) {
|
if (!sEGLLibrary.EnsureInitialized(flags & CreateContextFlags::FORCE_ENABLE_HARDWARE)) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -953,9 +953,9 @@ GLContextProviderEGL::CreateHeadless(bool requireCompatProfile, bool forceEnable
|
|||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
|
GLContextProviderEGL::CreateOffscreen(const mozilla::gfx::IntSize& size,
|
||||||
const SurfaceCaps& caps,
|
const SurfaceCaps& caps,
|
||||||
bool requireCompatProfile)
|
CreateContextFlags flags)
|
||||||
{
|
{
|
||||||
nsRefPtr<GLContext> glContext = CreateHeadless(requireCompatProfile);
|
nsRefPtr<GLContext> glContext = CreateHeadless(flags);
|
||||||
if (!glContext)
|
if (!glContext)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -1215,7 +1215,7 @@ DONE_CREATING_PIXMAP:
|
|||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderGLX::CreateHeadless(bool requireCompatProfile, bool forceEnabled)
|
GLContextProviderGLX::CreateHeadless(CreateContextFlags)
|
||||||
{
|
{
|
||||||
IntSize dummySize = IntSize(16, 16);
|
IntSize dummySize = IntSize(16, 16);
|
||||||
nsRefPtr<GLContext> glContext = CreateOffscreenPixmapContext(dummySize);
|
nsRefPtr<GLContext> glContext = CreateOffscreenPixmapContext(dummySize);
|
||||||
@@ -1228,9 +1228,9 @@ GLContextProviderGLX::CreateHeadless(bool requireCompatProfile, bool forceEnable
|
|||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderGLX::CreateOffscreen(const IntSize& size,
|
GLContextProviderGLX::CreateOffscreen(const IntSize& size,
|
||||||
const SurfaceCaps& caps,
|
const SurfaceCaps& caps,
|
||||||
bool requireCompatProfile)
|
CreateContextFlags flags)
|
||||||
{
|
{
|
||||||
nsRefPtr<GLContext> glContext = CreateHeadless(requireCompatProfile);
|
nsRefPtr<GLContext> glContext = CreateHeadless(flags);
|
||||||
if (!glContext)
|
if (!glContext)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -54,19 +54,21 @@ public:
|
|||||||
* resource sharing can be avoided on the target platform, it will
|
* resource sharing can be avoided on the target platform, it will
|
||||||
* be, in order to isolate the offscreen context.
|
* be, in order to isolate the offscreen context.
|
||||||
*
|
*
|
||||||
* @param aSize The initial size of this offscreen context.
|
* @param size The initial size of this offscreen context.
|
||||||
* @param aFormat The ContextFormat for this offscreen context.
|
* @param caps The SurfaceCaps for this offscreen context.
|
||||||
|
* @param flags The set of CreateContextFlags to be used for this
|
||||||
|
* offscreen context.
|
||||||
*
|
*
|
||||||
* @return Context to use for offscreen rendering
|
* @return Context to use for offscreen rendering
|
||||||
*/
|
*/
|
||||||
static already_AddRefed<GLContext>
|
static already_AddRefed<GLContext>
|
||||||
CreateOffscreen(const mozilla::gfx::IntSize& size,
|
CreateOffscreen(const mozilla::gfx::IntSize& size,
|
||||||
const SurfaceCaps& caps,
|
const SurfaceCaps& caps,
|
||||||
bool requireCompatProfile);
|
CreateContextFlags flags);
|
||||||
|
|
||||||
// Just create a context. We'll add offscreen stuff ourselves.
|
// Just create a context. We'll add offscreen stuff ourselves.
|
||||||
static already_AddRefed<GLContext>
|
static already_AddRefed<GLContext>
|
||||||
CreateHeadless(bool requireCompatProfile, bool forceEnabled = false);
|
CreateHeadless(CreateContextFlags flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create wrapping Gecko GLContext for external gl context.
|
* Create wrapping Gecko GLContext for external gl context.
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ GLContextProviderNull::CreateWrappingExisting(void*, void*)
|
|||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderNull::CreateOffscreen(const gfx::IntSize&,
|
GLContextProviderNull::CreateOffscreen(const gfx::IntSize&,
|
||||||
const SurfaceCaps&,
|
const SurfaceCaps&,
|
||||||
bool)
|
CreateContextFlags)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderNull::CreateHeadless(bool)
|
GLContextProviderNull::CreateHeadless(CreateContextFlags)
|
||||||
{
|
{
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -607,7 +607,7 @@ CreateWindowOffscreenContext()
|
|||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderWGL::CreateHeadless(bool requireCompatProfile, bool forceEnabled)
|
GLContextProviderWGL::CreateHeadless(CreateContextFlags)
|
||||||
{
|
{
|
||||||
if (!sWGLLib.EnsureInitialized()) {
|
if (!sWGLLib.EnsureInitialized()) {
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@@ -642,9 +642,9 @@ GLContextProviderWGL::CreateHeadless(bool requireCompatProfile, bool forceEnable
|
|||||||
already_AddRefed<GLContext>
|
already_AddRefed<GLContext>
|
||||||
GLContextProviderWGL::CreateOffscreen(const IntSize& size,
|
GLContextProviderWGL::CreateOffscreen(const IntSize& size,
|
||||||
const SurfaceCaps& caps,
|
const SurfaceCaps& caps,
|
||||||
bool requireCompatProfile)
|
CreateContextFlags flags)
|
||||||
{
|
{
|
||||||
nsRefPtr<GLContext> glContext = CreateHeadless(requireCompatProfile);
|
nsRefPtr<GLContext> glContext = CreateHeadless(flags);
|
||||||
if (!glContext)
|
if (!glContext)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ GLImage::GetAsSourceSurface()
|
|||||||
MOZ_ASSERT(NS_IsMainThread(), "Should be on the main thread");
|
MOZ_ASSERT(NS_IsMainThread(), "Should be on the main thread");
|
||||||
|
|
||||||
if (!sSnapshotContext) {
|
if (!sSnapshotContext) {
|
||||||
sSnapshotContext = GLContextProvider::CreateHeadless(false);
|
sSnapshotContext = GLContextProvider::CreateHeadless(CreateContextFlags::NONE);
|
||||||
if (!sSnapshotContext) {
|
if (!sSnapshotContext) {
|
||||||
NS_WARNING("Failed to create snapshot GLContext");
|
NS_WARNING("Failed to create snapshot GLContext");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -126,9 +126,8 @@ CompositorOGL::CreateContext()
|
|||||||
caps.preserve = false;
|
caps.preserve = false;
|
||||||
caps.bpp16 = gfxPlatform::GetPlatform()->GetOffscreenFormat() == gfxImageFormat::RGB16_565;
|
caps.bpp16 = gfxPlatform::GetPlatform()->GetOffscreenFormat() == gfxImageFormat::RGB16_565;
|
||||||
|
|
||||||
bool requireCompatProfile = true;
|
|
||||||
context = GLContextProvider::CreateOffscreen(mSurfaceSize,
|
context = GLContextProvider::CreateOffscreen(mSurfaceSize,
|
||||||
caps, requireCompatProfile);
|
caps, CreateContextFlags::REQUIRE_COMPAT_PROFILE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!context) {
|
if (!context) {
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ public:
|
|||||||
caps.preserve = false;
|
caps.preserve = false;
|
||||||
caps.bpp16 = false;
|
caps.bpp16 = false;
|
||||||
nsRefPtr<GLContext> context = GLContextProvider::CreateOffscreen(
|
nsRefPtr<GLContext> context = GLContextProvider::CreateOffscreen(
|
||||||
IntSize(gCompWidth, gCompHeight), caps, true);
|
IntSize(gCompWidth, gCompHeight), caps,
|
||||||
|
CreateContextFlags::REQUIRE_COMPAT_PROFILE);
|
||||||
return context.forget().take();
|
return context.forget().take();
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ void ShutdownTileCache();
|
|||||||
|
|
||||||
using namespace mozilla;
|
using namespace mozilla;
|
||||||
using namespace mozilla::layers;
|
using namespace mozilla::layers;
|
||||||
|
using namespace mozilla::gl;
|
||||||
|
|
||||||
gfxPlatform *gPlatform = nullptr;
|
gfxPlatform *gPlatform = nullptr;
|
||||||
static bool gEverInitialized = false;
|
static bool gEverInitialized = false;
|
||||||
@@ -494,7 +495,7 @@ gfxPlatform::Init()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOZ_GL_DEBUG
|
#ifdef MOZ_GL_DEBUG
|
||||||
mozilla::gl::GLContext::StaticInit();
|
GLContext::StaticInit();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
InitLayersAccelerationPrefs();
|
InitLayersAccelerationPrefs();
|
||||||
@@ -542,11 +543,11 @@ gfxPlatform::Init()
|
|||||||
gPlatform->mFontPrefsObserver = new FontPrefsObserver();
|
gPlatform->mFontPrefsObserver = new FontPrefsObserver();
|
||||||
Preferences::AddStrongObservers(gPlatform->mFontPrefsObserver, kObservedPrefs);
|
Preferences::AddStrongObservers(gPlatform->mFontPrefsObserver, kObservedPrefs);
|
||||||
|
|
||||||
mozilla::gl::GLContext::PlatformStartup();
|
GLContext::PlatformStartup();
|
||||||
|
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
// Texture pool init
|
// Texture pool init
|
||||||
mozilla::gl::TexturePoolOGL::Init();
|
TexturePoolOGL::Init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOZ_WIDGET_GONK
|
#ifdef MOZ_WIDGET_GONK
|
||||||
@@ -626,11 +627,11 @@ gfxPlatform::Shutdown()
|
|||||||
|
|
||||||
#ifdef MOZ_WIDGET_ANDROID
|
#ifdef MOZ_WIDGET_ANDROID
|
||||||
// Shut down the texture pool
|
// Shut down the texture pool
|
||||||
mozilla::gl::TexturePoolOGL::Shutdown();
|
TexturePoolOGL::Shutdown();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Shut down the default GL context provider.
|
// Shut down the default GL context provider.
|
||||||
mozilla::gl::GLContextProvider::Shutdown();
|
GLContextProvider::Shutdown();
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
// The above shutdown calls operate on the available context providers on
|
// The above shutdown calls operate on the available context providers on
|
||||||
@@ -639,7 +640,7 @@ gfxPlatform::Shutdown()
|
|||||||
// We should only support the default GL provider on Windows; then, this
|
// We should only support the default GL provider on Windows; then, this
|
||||||
// could go away. Unfortunately, we currently support WGL (the default) for
|
// could go away. Unfortunately, we currently support WGL (the default) for
|
||||||
// WebGL on Optimus.
|
// WebGL on Optimus.
|
||||||
mozilla::gl::GLContextProviderEGL::Shutdown();
|
GLContextProviderEGL::Shutdown();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// This is a bit iffy - we're assuming that we were the ones that set the
|
// This is a bit iffy - we're assuming that we were the ones that set the
|
||||||
@@ -1078,7 +1079,7 @@ gfxPlatform::InitializeSkiaCacheLimits()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::gl::SkiaGLGlue*
|
SkiaGLGlue*
|
||||||
gfxPlatform::GetSkiaGLGlue()
|
gfxPlatform::GetSkiaGLGlue()
|
||||||
{
|
{
|
||||||
#ifdef USE_SKIA_GPU
|
#ifdef USE_SKIA_GPU
|
||||||
@@ -1088,14 +1089,13 @@ gfxPlatform::GetSkiaGLGlue()
|
|||||||
* FIXME: This should be stored in TLS or something, since there needs to be one for each thread using it. As it
|
* FIXME: This should be stored in TLS or something, since there needs to be one for each thread using it. As it
|
||||||
* stands, this only works on the main thread.
|
* stands, this only works on the main thread.
|
||||||
*/
|
*/
|
||||||
bool requireCompatProfile = true;
|
nsRefPtr<GLContext> glContext;
|
||||||
nsRefPtr<mozilla::gl::GLContext> glContext;
|
glContext = GLContextProvider::CreateHeadless(CreateContextFlags::REQUIRE_COMPAT_PROFILE);
|
||||||
glContext = mozilla::gl::GLContextProvider::CreateHeadless(requireCompatProfile);
|
|
||||||
if (!glContext) {
|
if (!glContext) {
|
||||||
printf_stderr("Failed to create GLContext for SkiaGL!\n");
|
printf_stderr("Failed to create GLContext for SkiaGL!\n");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
mSkiaGlue = new mozilla::gl::SkiaGLGlue(glContext);
|
mSkiaGlue = new SkiaGLGlue(glContext);
|
||||||
MOZ_ASSERT(mSkiaGlue->GetGrContext(), "No GrContext");
|
MOZ_ASSERT(mSkiaGlue->GetGrContext(), "No GrContext");
|
||||||
InitializeSkiaCacheLimits();
|
InitializeSkiaCacheLimits();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,8 +75,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<gl::GLContext> gl;
|
nsRefPtr<gl::GLContext> gl;
|
||||||
bool requireCompatProfile = true;
|
gl = gl::GLContextProvider::CreateHeadless(gl::CreateContextFlags::REQUIRE_COMPAT_PROFILE);
|
||||||
gl = gl::GLContextProvider::CreateHeadless(requireCompatProfile);
|
|
||||||
|
|
||||||
if (!gl) {
|
if (!gl) {
|
||||||
// Setting mReady to true here means that we won't retry. Everything will
|
// Setting mReady to true here means that we won't retry. Everything will
|
||||||
|
|||||||
Reference in New Issue
Block a user