Closed
Bug 686083
Opened 13 years ago
Closed 13 years ago
No way to switch between GL implementations for WebGL
Categories
(Core :: Graphics: CanvasWebGL, defect)
Tracking
()
RESOLVED
FIXED
mozilla10
People
(Reporter: jgilbert, Assigned: jgilbert)
References
Details
Attachments
(1 file, 4 obsolete files)
3.17 KB,
patch
|
jgilbert
:
review+
|
Details | Diff | Splinter Review |
The implementations are tried in order, falling back to the next in line if an implementation fails to initialize. If one's system supports the first implementation, it's not possible to try other (later) implementations even if they are also supported by the system. For windows, the order is: ANGLE+EGL WGL (PBuffers) WGL (FBOs)
Assignee | ||
Comment 1•13 years ago
|
||
A way of disabling each implementation would allow implementations below it to be tested.
Comment 2•13 years ago
|
||
We have webgl.prefer_native_gl in about:config, but we don't have a way of selecting between WGL+PBuffers and WGL+FBOs. But I think this is a bit too internal to warrant a pref. If you think this is useful, maybe the right balance is to make it a hidden pref: query it in c++ code like any other pref, but don't list it in all.js so that it doesn't show up in about:config unless the user explicitly created it.
Assignee | ||
Comment 3•13 years ago
|
||
A hidden pref was my thought. It would help with testing and assuring that all the branches pass conformance tests while making changes.
Assignee | ||
Comment 4•13 years ago
|
||
Simple patch. Just adds a hidden pref called "wgl.prefer-fbo" which defaults to false (usually, we try PBuffers first, and only use FBOs if PBuffers fails to initialize). When enabled, it skips trying PBuffers, and tries FBOs.
Attachment #560487 -
Flags: review?(bjacob)
Assignee | ||
Updated•13 years ago
|
OS: Windows 7 → All
Summary: No way to switch between GL implementations for WebGL on Windows → No way to switch between GL implementations for WebGL
Assignee | ||
Comment 5•13 years ago
|
||
There's a need for a parallel pref for Mac's CGL path, so I added "cgl.prefer-fbo" to enable that.
Assignee | ||
Comment 6•13 years ago
|
||
Attachment #562893 -
Flags: review?
Assignee | ||
Comment 7•13 years ago
|
||
Attachment #560487 -
Attachment is obsolete: true
Attachment #562893 -
Attachment is obsolete: true
Attachment #560487 -
Flags: review?(bjacob)
Attachment #562893 -
Flags: review?
Attachment #562895 -
Flags: review?(bjacob)
Assignee | ||
Comment 8•13 years ago
|
||
Try run: https://tbpl.mozilla.org/?tree=Try&usebuildbot=1&rev=bb7dd7636b4c
Updated•13 years ago
|
Attachment #562895 -
Flags: review?(bjacob) → review+
Assignee | ||
Comment 9•13 years ago
|
||
Comment on attachment 562895 [details] [diff] [review] Adds hidden prefs wgl.prefer-fbo and cgl.prefer-fbo >From: Jeff Gilbert <jgilbert@mozilla.com> >Fix for 686083: Adds method to disable GL implementations > >diff --git a/gfx/thebes/GLContextProviderCGL.mm b/gfx/thebes/GLContextProviderCGL.mm >--- a/gfx/thebes/GLContextProviderCGL.mm >+++ b/gfx/thebes/GLContextProviderCGL.mm >@@ -41,16 +41,17 @@ > #include <OpenGL/gl.h> > #include <AppKit/NSOpenGL.h> > #include "gfxASurface.h" > #include "gfxImageSurface.h" > #include "gfxQuartzSurface.h" > #include "gfxPlatform.h" > #include "gfxFailure.h" > #include "prenv.h" >+#include "mozilla/Preferences.h" > > namespace mozilla { > namespace gl { > > static PRBool gUseDoubleBufferedWindows = PR_TRUE; > > class CGLLibrary > { >@@ -553,26 +554,31 @@ CreateOffscreenFBOContext(const gfxIntSi > return glContext.forget(); > } > > already_AddRefed<GLContext> > GLContextProviderCGL::CreateOffscreen(const gfxIntSize& aSize, > const ContextFormat& aFormat) > { > nsRefPtr<GLContextCGL> glContext; >- >- glContext = CreateOffscreenPBufferContext(aSize, aFormat); >- if (glContext && >- glContext->Init()) >+ >+ NS_ENSURE_TRUE(Preferences::GetRootBranch(), nsnull); >+ PRBool preferFBOs = Preferences::GetBool("cgl.prefer-fbo", PR_FALSE); >+ if (!preferFBOs) > { >- glContext->mOffscreenSize = aSize; >- glContext->mOffscreenActualSize = aSize; >- >- return glContext.forget(); >- } >+ glContext = CreateOffscreenPBufferContext(aSize, aFormat); >+ if (glContext && >+ glContext->Init()) >+ { >+ glContext->mOffscreenSize = aSize; >+ glContext->mOffscreenActualSize = aSize; >+ >+ return glContext.forget(); >+ } >+ } > > // try a FBO as second choice > glContext = CreateOffscreenFBOContext(aSize, aFormat); > if (glContext && > glContext->Init() && > glContext->ResizeOffscreenFBO(aSize)) > { > return glContext.forget(); >diff --git a/gfx/thebes/GLContextProviderWGL.cpp b/gfx/thebes/GLContextProviderWGL.cpp >--- a/gfx/thebes/GLContextProviderWGL.cpp >+++ b/gfx/thebes/GLContextProviderWGL.cpp >@@ -43,16 +43,18 @@ > #include "gfxImageSurface.h" > #include "gfxPlatform.h" > #include "gfxWindowsSurface.h" > > #include "gfxCrashReporterUtils.h" > > #include "prenv.h" > >+#include "mozilla/Preferences.h" >+ > namespace mozilla { > namespace gl { > > WGLLibrary sWGLLibrary; > > static HWND gSharedWindow = 0; > static HDC gSharedWindowDC = 0; > static HGLRC gSharedWindowGLContext = 0; >@@ -611,17 +613,20 @@ GLContextProviderWGL::CreateOffscreen(co > if (!sWGLLibrary.EnsureInitialized()) { > return nsnull; > } > > nsRefPtr<GLContextWGL> glContext; > > // Always try to create a pbuffer context first, because we > // want the context isolation. >- if (sWGLLibrary.fCreatePbuffer && >+ NS_ENSURE_TRUE(Preferences::GetRootBranch(), nsnull); >+ PRBool preferFBOs = Preferences::GetBool("wgl.prefer-fbo", PR_FALSE); >+ if (!preferFBOs && >+ sWGLLibrary.fCreatePbuffer && > sWGLLibrary.fChoosePixelFormat) > { > glContext = CreatePBufferOffscreenContext(aSize, aFormat); > } > > // If it failed, then create a window context and use a FBO. > if (!glContext) { > glContext = CreateWindowOffscreenContext(aSize, aFormat);
Assignee | ||
Comment 10•13 years ago
|
||
Derp, that didn't do what I thought it would do. There are some tabs which snuck in to the patch. Will reupload shortly.
Assignee | ||
Comment 11•13 years ago
|
||
Here's the patch with the tabs fixed.
Assignee | ||
Comment 12•13 years ago
|
||
Carryover r+ from bjacob, updated to include conversion from PRBool to bool.
Attachment #562895 -
Attachment is obsolete: true
Attachment #567414 -
Attachment is obsolete: true
Attachment #567826 -
Flags: review+
Comment 14•13 years ago
|
||
Re-landed with proper commit message (sorry, should have checked that): http://hg.mozilla.org/integration/mozilla-inbound/rev/f5f1228fc7ab
Comment 15•13 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/f5f1228fc7ab
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla10
You need to log in
before you can comment on or make changes to this bug.
Description
•