Jump to content

OpenCL: Difference between revisions

653 bytes added ,  10 December 2020
Line 260: Line 260:
;Notes
;Notes
* 3-component data types are aligned to 4 components. I.e. an array of <code>uchar3</code> with 4 elements will be equivalent to an array of <code>uchar4</code> with 4 elements.
* 3-component data types are aligned to 4 components. I.e. an array of <code>uchar3</code> with 4 elements will be equivalent to an array of <code>uchar4</code> with 4 elements.
==OpenGL Interop==
See [https://software.intel.com/content/www/us/en/develop/articles/opencl-and-opengl-interoperability-tutorial.html OpenCL™ and OpenGL* Interoperability Tutoria].
In C++, you can use [https://github.khronos.org/OpenCL-CLHPP/classcl_1_1_image_g_l.html <code>cl::ImageGL</code>] to access textures in OpenGL. 
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.


==Advanced Topics==
==Advanced Topics==
====Local Memory v. Global Memory====
====Local Memory v. Global Memory====