Closed Bug 571831 Opened 14 years ago Closed 14 years ago

Use FBOs for WebGL

Categories

(Core :: Graphics: CanvasWebGL, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: romaxa, Assigned: vlad)

References

Details

Attachments

(1 file, 4 obsolete files)

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: nobody → vladimir
Depends on: 575032
OS: Linux (embedded) → All
Hardware: x86 → All
Summary: Make canvas rendering using FBO, or windowSurface → Use FBOs for WebGL
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)
Attached patch 2 - Use FBOs for WebGL (obsolete) — Splinter Review
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 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 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+
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 ?
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.
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!
(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.
Sure. Don't worry, Vlad's going to do that and push it... when he has time :-)
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 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+
(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?
Depends on: 579931
No longer depends on: 579931
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.
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.

Attachment

General

Created:
Updated:
Size: