[Public WebGL] getSupportedExtensions + context loss

Glenn Maynard [email protected]
Fri Apr 6 15:20:34 PDT 2012


getSupportedExtensions says "Any string in this list, when passed to
getExtension must return a valid object."

Currently, this conflicts normatively with what actually happens: if the
context is lost, null is returned.  A quick fix is to move this to
getExtension (it's defining getExtension requirements, so it should be
within that function's definition), and say "A valid object must be
returned if (and only if) *name* is included in the return value of
getSupportedExtensions."  (This doesn't really touch on the fact that
getSupportedExtensions can change after a context loss and restoration.
I'm not sure if anything normative is needed about that...)

Aside from this, I think a better fix would be for both getExtension and
getSupportedExtensions to ignore context loss.  getSupportedExtensions
always returns the set of supported extensions for the last-created
context, and getExtension always returns extension objects (even for lost
contexts).  That eliminates some possible context-loss-related bugs.  For
example:

if(ctx.getSupportedExtensions.indexOf("extension") != -1) {
    var ext = ctx.getExtension("extension");
    ext.func();
}

This isn't a common pattern now, but if the "profile extensions" ever gets
any traction--I wish that would get some attention--then it would be useful.

(Later, for the "context initially lost" case, I think we should have the
initially-lost case define a strict, narrow set of functions that you're
allowed to use in that state.  That set might be empty--you can't call any
context methods whatsoever, and the only thing you can do is wait for
context restoration.  That way, we don't need to define what functions do
in that very exceptional case.  After all, the UA might not even have a
real WebGL implementation in that state, or have any GPU or drawing API
active, so there's nothing meaningful any WebGL function could do.)

-- 
Glenn Maynard
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://khronos.org/pipermail/public_webgl_khronos.org/attachments/20120406/a14f280e/attachment.html>


More information about the public_webgl mailing list