Closed
Bug 571831
Opened 14 years ago
Closed 14 years ago
Use FBOs for WebGL
Categories
(Core :: Graphics: CanvasWebGL, defect)
Core
Graphics: CanvasWebGL
Tracking
()
RESOLVED
FIXED
People
(Reporter: romaxa, Assigned: vlad)
References
Details
Attachments
(1 file, 4 obsolete files)
15.39 KB,
patch
|
bjacob
:
review+
|
Details | Diff | Splinter Review |
On Maemo platform CreatePBuffer is not supported. and GL Canvas currently requesting PBuffer surface, and if that failed, then it stop work
http://mxr.mozilla.org/mozilla-central/source/content/canvas/src/WebGLContext.cpp#177
It would be nice to check for PBuffer support, and if that is not supported, then use something else... like FBO, or create offscreen window surface like X-Surface..
Assignee | ||
Updated•14 years ago
|
Assignee: nobody → vladimir
Depends on: 575032
OS: Linux (embedded) → All
Hardware: x86 → All
Summary: Make canvas rendering using FBO, or windowSurface → Use FBOs for WebGL
Assignee | ||
Comment 1•14 years ago
|
||
With shared contexts, we need to be sure we clean up after ourselves and after WebGL. Do so whenever we destroy a webgl context.
Attachment #454576 -
Flags: review?(bjacob)
Assignee | ||
Comment 2•14 years ago
|
||
Use FBOs for rendering, via new CreateOffscreen GLContextProvider API. We set up the FBO ourselves, and provide it to the Canvas layers for rendering.
Attachment #454577 -
Flags: review?(bjacob)
Comment 3•14 years ago
|
||
Comment on attachment 454576 [details] [diff] [review]
1 - do proper resource cleanup on context destruction
+static PLDHashOperator
+DeleteTextureFunction(const PRUint32& aKey, WebGLTexture *aValue, void *aData)
+{
The aKey parameter here is unused, so it should be unnamed to avoid compiler warnings.
DeleteTextureFunction(const PRUint32& /*aKey*/, WebGLTexture *aValue, void *aData)
Attachment #454576 -
Flags: review?(bjacob) → review+
Comment 4•14 years ago
|
||
Comment on attachment 454577 [details] [diff] [review]
2 - Use FBOs for WebGL
I just have 1 question and 1 comment.
WebGLContext::SetDimensions(PRInt32 width, PRInt32 height)
{
+ if (mWidth == width && mHeight == height)
+ return NS_OK;
Question: what if for some reason the canvas size was actually 0x0 pixels? Since 0x0 is the size the WebGLContext constructor initializes with, SetDimentions(0,0) is a no-operation. Is that OK?
+ bool alpha = mContextFormat.alpha > 0;
Is it possible to rename bool alpha to bool hasAlpha ? Otherwise it's a bit confusing that one alpha is bool and not the other.
Attachment #454577 -
Flags: review?(bjacob) → review+
Comment 5•14 years ago
|
||
Actually, I have one more small comment:
+#ifdef USE_GLES2
+ const bool isMobile = true;
+#else
+ const bool isMobile = false;
+#endif
is it really a good idea to equate GLES==mobile? Why not call that isGLES ?
Assignee | ||
Comment 6•14 years ago
|
||
Assignee | ||
Comment 7•14 years ago
|
||
Assignee | ||
Updated•14 years ago
|
Attachment #455555 -
Attachment is obsolete: true
Comment 8•14 years ago
|
||
bjacob asked me to give this patch a try during the summit because webgl does not work for me at all (on intel i945 graphics). Sadly, the patch doesn't apply to the current code in central anymore.
Comment 9•14 years ago
|
||
intel 945 doesn't have programmable shaders, so it can't be used for WebGL. The earliest Intel chipsets with programmable shaders are the GMA X3000 generation from 2006,
http://en.wikipedia.org/wiki/Intel_GMA#History
Sorry!
Comment 10•14 years ago
|
||
(In reply to comment #8)
> [...] on intel i945 graphics) [...]
...or so I was thinking. I never really understood intel's naming scheme and seeing the driver module being called "i915" certainly didn't help. Anyway, turns out I actually have one of the very common X3100 (GM965). But I didn't mean to hijack this bug, just wanted to say that the patch needs updating.
Comment 11•14 years ago
|
||
Sure. Don't worry, Vlad's going to do that and push it... when he has time :-)
Assignee | ||
Comment 13•14 years ago
|
||
Ok, final change. This uses the offscreen glcontext API introduced in bug 575469, and pushes the decision of pbuffers vs FBOs into the specific glcontext. The linux GLX provider should be using FBOs and context sharing exclusively.
Attachment #454576 -
Attachment is obsolete: true
Attachment #454577 -
Attachment is obsolete: true
Attachment #455608 -
Attachment is obsolete: true
Attachment #458062 -
Flags: review?(bjacob)
Comment 14•14 years ago
|
||
Comment on attachment 458062 [details] [diff] [review]
updated for offscreen glcontext api
Just one remark:
// increment the generation number
++mGeneration;
+#if 0
+ if (mGeneration > 0) {
+ // XXX dispatch context lost event
+ }
+#endif
+
I understand this is just a placeholder, but this needs to go before the ++mGeneration, or it will dispatch a lost event on the first call.
Attachment #458062 -
Flags: review?(bjacob) → review+
Comment 15•14 years ago
|
||
(In reply to comment #13)
> The linux GLX provider should be using FBOs and context sharing
> exclusively.
Why special-case GLX here? I understand that many GLX systems don't support Pbuffers, but if they don't, the Pbuffer creation just fails so you know it. So why bother special-case-ing GLX?
Assignee | ||
Comment 16•14 years ago
|
||
Mainly because pbuffer set up on linux is somewhat more complex than on other systems, and it seemed like a pain to maintain it; we can always put it back, though.
Assignee | ||
Comment 17•14 years ago
|
||
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•