Khronos Public Bugzilla
Bug 846 - Redefine optional parameter from WebCLGL.createContext(...)
Redefine optional parameter from WebCLGL.createContext(...)
Status: RESOLVED FIXED
Product: WebCL
Classification: Unclassified
Component: Specification
1.0
All All
: P3 normal
: ---
Assigned To: WebCL Mailing List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-04-03 14:16 PDT by steven eliuk
Modified: 2013-10-10 07:11 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description steven eliuk 2013-04-03 14:16:57 PDT
{WebCL namespace, WebCLPlatform, WebCLDevice}.getExtension() returns an extension based object. The object is valid at the WebCL level because the extension is valid for all objects given the query of getSupportedExtensions() returns the intersection of all supported extensions on platforms and devices.

The issue arises when one obtains an object from the platform, or device level, and then specifies a different platform or device in the optional WebCLContextProperties argument of WebCLGLContext? createContext(optional WebCLContextProperties properties). The results are undefined,
i.e.)one could query a device that has cl-gl interop and creates the WebCLGL object through getExtension(), then specify a different device in the param (optional WebCLContextProperties properties) that does not support the interop/extension when calling WebCLGL.createContext(properties).

We suggest linking the object to the {platform or device} and removing the ability to specify different platform and device in the optional param,

Any other thoughts?
Comment 1 Tomi Aarnio 2013-04-04 08:48:46 PDT
> We suggest linking the object to the {platform or device} and removing the
> ability to specify different platform and device in the optional param,

Makes sense to me. Here are some examples to clarify:

  var clgl = myDevice.getExtension("KHR_GL_SHARING");

  var ctx1 = clgl.createContext();  // OK, uses myDevice by default
  var ctx2 = clgl.createContext({ device: myDevice });  // OK
  var ctx3 = clgl.createContext({ device: anyOtherDevice });  // FAIL
Comment 2 Antonio Gomes 2013-04-22 07:19:50 PDT
(In reply to comment #1)
> > We suggest linking the object to the {platform or device} and removing the
> > ability to specify different platform and device in the optional param,
> 
> Makes sense to me. Here are some examples to clarify:
> 
>   var clgl = myDevice.getExtension("KHR_GL_SHARING");
> 
>   var ctx1 = clgl.createContext();  // OK, uses myDevice by default
>   var ctx2 = clgl.createContext({ device: myDevice });  // OK
>   var ctx3 = clgl.createContext({ device: anyOtherDevice });  // FAIL

+1.

On the implementation side, it is easy to ASSERT in order to catch such mistakes  or throw runtime exceptions.
Comment 3 Tomi Aarnio 2013-04-26 05:27:03 PDT
(In reply to comment #2)

Decision at the face-to-face meeting on April 26, 2013:

Adopt the following behavior, as proposed: 

  var clgl = myDevice.getExtension("KHR_GL_SHARING");
  var ctx1 = clgl.createContext();  // OK, uses myDevice by default
  var ctx2 = clgl.createContext({ device: myDevice });  // OK
  var ctx3 = clgl.createContext({ device: anyOtherDevice });  // FAIL

In plain English, you can only create a context for the particular Device you got the extension object from. If you got the extension object from a Platform, you can create a context for any device on that platform. If you got the extension object from the global WebCL object, you can create a context for any device.

Leaving the bug open until this is written down in the spec.
Comment 4 Tomi Aarnio 2013-10-10 07:11:20 PDT
(In reply to comment #3)

> Leaving the bug open until this is written down in the spec.

Added the following:

      Calling <code>enableExtension("KHR_GL_SHARING")</code> on a
      WebCLPlatform or WebCLDevice, instead of the global WebCL
      object, returns an extension object that is restricted to that
      particular platform or device. Any other platform or device is
      considered invalid by `createContext`.

Closing this ticket.