WebGL
Khronos
 

WebGL WEBGL_shared_resources Extension Draft Specification

Name

WEBGL_shared_resources

Contact

WebGL working group (public_webgl 'at' khronos.org)

Contributors

Members of the WebGL working group

Version

Last modified date: May 14, 2013
Revision: 2

Number

WebGL extension #22

Dependencies

Written against the WebGL API 1.0 specification.

Overview

This extension exposes the ability to share WebGL resources with multiple WebGLRenderingContexts.

Background:

The OpenGL ES spec defines that you can share a resource (texture, buffer, shader, program, renderbuffer) with 2 or more GL contexts but with some caveats. To guarantee you'll see a change made in one context in other context requires calling glFinish on the context that made the change and call glBind on the context that wants to see the change.

Not calling glFinish and/or glBind does not guarantee you won't see the results which means that users may do neither and their app might just happen to work on some platforms and mysteriously have glitches, rendering corruption, gl errors or program failure on others.

WebGL must present consistent behavior for sharing and so this extension provides an API so that implementions can enforce and optimize these requirements.

When this extension is enabled:

IDL

interface WEBGL_shared_resources {
     const GLenum READ_ONLY  = 0x0001;
     const GLenum EXCLUSIVE  = 0x0004;

     const GLenum READ_FRAMEBUFFER = 0x8CA8;
     const GLenum DRAW_FRAMEBUFFER = 0x8CA9;

     readonly attribute WebGLShareGroup group;

     long acquireSharedResource(
         WebGLSharedObject resource,
         GLenum mode,
         AcquireResourcesCallback callback);
     void releaseSharedResource(
         WebGLSharedObject resource);
     void cancelAcquireSharedResource(long id);
};

callback AcquireSharedResourcesCallback = void ();

interface WebGLShareGroup {
}

interface WebGLSharedObject : WebGLObject {
}

interface WebGLBuffer : WebGLSharedObject {
}

interface WebGLProgram : WebGLSharedObject {
}

interface WebGLRenderbuffer : WebGLSharedObject {
}

interface WebGLShader : WebGLSharedObject {
}

interface WebGLTexture : WebGLSharedObject {
}
  

Issues

Revision History

Revision 1, 2012/02/06

Revision 2, 2013/05/14