[Public WebGL] Null return values from create*

Glenn Maynard [email protected]
Wed Apr 4 18:21:50 PDT 2012

On Wed, Apr 4, 2012 at 8:00 PM, Kenneth Russell <[email protected]> wrote:

> Glenn, thanks for raising this issue again. After giving this more
> thought I am increasingly in favor of your proposal to return
> invalidated WebGLObjects from the create* methods if the context is
> lost, because of the unification of error handling behavior.
> There are some things to consider. It will still be the case that some
> get* methods will return null values in certain situations, in
> particular when passed invalidated objects (per
> http://www.khronos.org/registry/webgl/specs/latest/#5.14). Is this an
> issue? If the goal is to eliminate the majority of null return values
> under error conditions, that is a much larger change, and one which I
> think should be done incrementally.

The goal here is just to eliminate the extremely rare, racey case where
create* functions return null, and as a side-effect to reduce the number of
branches in user code that need to be tested.  If you create and use a
texture, there are only two major cases related to context loss instead of
an exceptionally rare third.  That rare third case is hard to test
comprehensively even with use of WEBGL_lose_context.

Reducing the cases where null is returned by other functions is worth
looking into, too, but let's come back to those another time.

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

More information about the public_webgl mailing list