WEBGL_lose_context WEBKIT_WEBGL_lose_context MOZ_WEBGL_lose_context enne@chromium.org Members of the WebGL working group Glenn Maynard 3

This extension exposes new functions which simulate losing and restoring the WebGL context, even on platforms where the context can never be lost. Consult the WebGL specification for documentation about the webglcontextlost and webglcontextrestored events.

When this extension is enabled:

Note that this extension is not disconnected from the WebGLRenderingContext if that object loses its context as described in "The Context Lost Event" of the WebGL specification, either through use of this API or via actual circumstances such as a system failure.

[NoInterfaceObject] interface WEBGL_lose_context { void loseContext(); void restoreContext(); };

When this function is called and the context is not lost, simulate losing the context so as to trigger the steps described in the WebGL spec for handling context lost. The context will remain in the lost state according to the WebGL specification until restoreContext() is called. If the context is already lost when this function is called, generate an INVALID_OPERATION error.

Implementations should destroy the underlying graphics context and all graphics resources when this method is called. This is the recommended mechanism for applications to programmatically halt their use of the WebGL API.

When this function is called while the context is lost, and the conditions defined by the WebGL specification for restoring the context are met, simulate the context being restored so as to trigger the steps described in the WebGL spec for handling the context being restored. If the context is already restored when this function is called, or if the conditions in the WebGL specification for restoring the context are not satisfied, or if the context was not lost via loseContext(), generate an INVALID_OPERATION error.
Initial revision. Added explicit restoreContext() method based on discussion on public_webgl list, to enable testing of scenario where context stays lost for a period of time. Renamed from WEBKIT_lose_context to WEBGL_EXT_lose_context Changed to make it clear this extension should follow the WebGL spec for the steps involved in handling losing and restoring the context rather than just fire events. Added vendor-specific name strings for draft extension per discussion on WebGL mailing list Renamed from WEBGL_EXT_lose_context to WEBGL_lose_context Renamed "Name Strings" section to "Alias Name Strings". Removed webgl module per changes to Web IDL spec. Moved from draft to community approved status Ratified by Khronos Board of Promoters. Clarified error generation that conflicted with WebGL spec. Indicated that this extension is not disconnected from the WebGLRenderingContext when that object loses its drawing buffer (i.e. when it performs the steps outlined in "The Context Lost Event" of the WebGL specification). Added INVALID_OPERATION for restoreContext() without loseContext() Added NoInterfaceObject extended attribute. Per discussion in working group, document that this extension should destroy the underlying context and all graphics resources.