On 07/14/2013 11:46 PM, Zhigang Gong wrote:
Hi Kristian,
The OpenCL spec has one extension to support interoperation between OpenGL and
OpenCL.
The key requirement for this extension is to export an OpenGL resource
(texture/buffer object/render buffer)'s internal attributes to the OpenCL's
driver side.
IMHO, to support that cl extension we may need to add a new extension to the
EGL/DRI layer
which let the OpenCL driver could use this interface to query the low level
attributes of
the resource from the mesa dri driver side. Thus I propose this extension as
below:
EGLAPI EGLBoolean EGLAPIENTRY eglAcquireResourceMESA(EGLDisplay dpy, EGLContext
ctx, const EGLenum target, const EGLint *attrib_list, void * user_data);
EGLAPI EGLBoolean EGLAPIENTRY eglReleaseResourceMESA(EGLDisplay dpy, EGLContext
ctx, const EGLenum target, const EGLint *attrib_list);
The first API is to acquire the specified resource and get the low level
attribute back
in the driver specified user_data structure. The OpenCL side could use this
structure to
create a correct buffer object in OpenCL domain. The eglAcquireResourceMESA
will also
implicitly increase the resoruce's reference counter.
The second API is to be called when the resource is no longer be shared with
Open CL
domain. It will decrease the resource's reference counter.
The following patchset is to implement this extension, and I also implemented
the OpenCL side
on Beignet's runtime library. The texture sharing part works fine.
Any comments are welcome and if this new extension is not the right way to
solve the
original problem, please feel free to point it out and kindly guide which is
the right
way to implement the cl-gl interoperations. Thanks.
Any new OpenGL extension should have a specification. You can find the
OpenGL extension template at http://www.opengl.org/registry/doc/template.txt
I can hardly guess what the two new functions do without documentation
of their parameters and behaviour.
-Brian
_______________________________________________
mesa-dev mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/mesa-dev