[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Public WebGL] Null return values from create*

On Wed, Apr 4, 2012 at 8:00 PM, Kenneth Russell <kbr@google.com> 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