Jump to content

OpenCL: Difference between revisions

251 bytes added ,  10 December 2020
Line 270: Line 270:
Note that <code>cl::Image</code> and <code>cl::Buffer</code> are not the same thing. A buffer is a contiguous section of memory whereas an image is a mipmapped texture. Interchanging them will result in <code>CL_INVALID_MEM_OBJECT</code> errors or similar.
Note that <code>cl::Image</code> and <code>cl::Buffer</code> are not the same thing. A buffer is a contiguous section of memory whereas an image is a mipmapped texture. Interchanging them will result in <code>CL_INVALID_MEM_OBJECT</code> errors or similar.
I recommend writing to a separate buffer and copying to images.
I recommend writing to a separate buffer and copying to images.
See [https://www.khronos.org/registry/OpenCL/sdk/2.2/docs/man/html/clCreateFromGLTexture.html clCreateFromGLTexture] to get a list of compatible pixel formats. 
If in doubt, use <code>GL_RGBA8</code> which is the most likely format to be supported.


===Buffers===
===Buffers===