[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] Null return values from create*
On Mon, Apr 9, 2012 at 2:51 AM, Cameron McCormack <email@example.com>
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:
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.