Suggestion for future OpenCL functionalities

Hello

I dont know if this is the right place to post suggestions.

However, recently i’ve been digging into CL-GL interoperability, and i feel it’s quite limited in many ways.

The biggest limitation i feel is that it is possible to obtain cl_mem buffers from OpenGL objects, such as Texture2D, Texture3D, BufferObject, RenderBuffer, but not the other way around.

There are some examples where OpenCL is used to postprocess OpenGL output, which makes perfectly sense.
However OpenCL can also be succesfully used to produce data that must be visualized with OpenGL.

So i think it would be very practical to be able to use cl_mem buffers in OpenGL without having to decide a priori how you want to use that buffer (therefore limiting yourself in using a specific buffer in a specific OpenGL mode, let say Texture3D)
and WITHOUT having to go through bufferObjects and therefore copying memory, as it is now if we want to have such a freedom

One more use of such capability (using cl_mem buffers in openGL directly) could be to use only a part of a buffer as , let say, texture.
So, for example, if we have a large buffer, containing 4D data, it would be nice to create 3D textures out of it without having to copy a part of the buffer each time using bufferObjects.
The same applies to 3D data and 2D textures extraction (slices)

what do you think?
Does it make sense, or going through bufferObject and thus copying data every time is not such a big deal?

I have used OpenGL, well GLSL, but am not doing anything visual to directly comment. There is another forum on this site for future release suggestions. That may be a better choice for this thread.

In fact, you can see all the OpenCL forums from viewforum.php?f=27

So i think it would be very practical to be able to use cl_mem buffers in OpenGL without having to decide a priori how you want to use that buffer (therefore limiting yourself in using a specific buffer in a specific OpenGL mode, let say Texture3D)
and WITHOUT having to go through bufferObjects and therefore copying memory, as it is now if we want to have such a freedom

I’m trying to understand your viewpoint. When you mention “bufferObjects” are you referring to Vertex Buffer Objects (VBOs)?

I’m surprised by “therefore copying memory”. OpenGL and OpenCL share objects; there’s no data copy involved.

As for why CL objects are created from GL objects and not the other way around, it’s a matter of resource management. It doesn’t look like a great burden to the application to create these objects in OpenGL and then share them in OpenCL.

Whether the actual data flows from CL to GL or viceversa has nothing to do with the fact that the objects must be created from GL first and then shared.

You are right, i am sorry, i ask if a moderator could move the thread to the appropriate forum, i havent seen the one for suggestions for future releases…

About what David says, when i talk about buffer objects, i mean what you get by using glCreateBuffer.

in this case you can use clCreateFromGLBuffer, from one side (CL side) and get your cl_mem, and from the other side (GL side) you can most likely create any kind of texture, or buffer object (VBO, PBO, TBO).
But, as far as i can understand, it involves memory copying, as, for example, when you want to create a texture from a bufferObject, you must still use glTexImageND() after you bind the buffer object.

If you go the other way (allocate the buffer in OpenGL), you cannot
a) use your buffer as something else, in OpenGL (for example a texture as a VBO)
b) there might be the case that you want in a single buffer more data that you would keep in a single texture. For example you might want to have 4D data in a buffer, but use only 3D data into your texture, therefore using only pieces of your buffer at a time.

I hope i explained myself correctly… : )