[Public WebGL] Null return values from create*

Glenn Maynard [email protected]
Fri Apr 13 16:17:05 PDT 2012

On Mon, Apr 9, 2012 at 2:51 AM, Cameron McCormack <[email protected]> wrote:

> Do you want annotations that just control the behaviour of the operations
> (to save writing prose on each one checking for whether the context has
> been lost and returning null)?

Right now, WebGL has a list of functions in prose:

> The following methods have explicit context lost handling:
 >   isContextLost, checkFramebufferStatus, getAttribLocation,
getContextAttributes, getError, getVertexAttribOffset, isBuffer, isEnabled,
isFramebuffer, isProgram, isRenderbuffer, isShader, isTexture

which is then used in a method dispatch algorithm, which is run before any
method in the interface is run:

> 1. If the called method is in the list of methods with explicit context
lost handling, perform the implementation of the called method, return its
result and terminate these steps.

I'm looking for a way to change the ad-hoc, out-of-line list to something
in the IDL, which would allow sanity checks more easily (can't have a
non-nullab/any return type without explicit context loss handling).  It
could also be useful for generating bindings, at least in theory.

 If so, I think using an extended attribute for this would be fine:
>  http://dev.w3.org/2006/webapi/**WebIDL/#extensibility<http://dev.w3.org/2006/webapi/WebIDL/#extensibility>
> I don't see any problem with defining say [WebGLContextLoss] in the WebGL
> spec and writing
>  [WebGLContextLoss] sequence<DOMString>? getSupportedExtensions();
> (Is it worth Web IDL having an explicit spec-local naming convention for
> extended attributes like this?  Or perhaps some character that introduces
> spec-local extended attributes, like [@ContextLoss]?)

[WebGLContextLoss] seems better.  That way, other specs can refer to it,
which wouldn't be possible with [@ContextLoss].  In particular, WebGL
extension specs would also use this.

Does this language sound OK?  "1. If the [WebGLContextLoss] extended
attribute appears on the called method, perform the implementation of the
called method, return its result and terminate these steps."

Cameron or Boris: By the way, the overall method dispatch steps in 5.14
are, I think, unique in the platform.  If either of you have time, it could
probably use a review.

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

More information about the public_webgl mailing list