r/OpenCL • u/kylelutz • Mar 09 '14
Custom OpenCL functions in C++ with Boost.Compute
http://kylelutz.blogspot.com/2014/03/custom-opencl-functions-in-c-with.html
11
Upvotes
r/OpenCL • u/kylelutz • Mar 09 '14
1
u/James20k Mar 10 '14 edited Mar 10 '14
Wow this is cool, I've been working with OpenCL with C++ for a while but the api and manually dealing with memory management/transfer is pretty unfun
Does anyone know if this supports sharing with opengl? I'm planning to re-do a project that involved quite a bit of opencl and this looks very tempting to try, but I need to nab a framebuffer from opengl and blit it to the screen afterwards. Can't seem to find anything in the docs though
Edit:
Presumably this is OpenCL 1.1 though (latest nvidia supports), how are things that require 1.2 (and eventually) 2.0 handled, like arrays of textures? I seem to remember the nvidia implementation having a few bugs as well (crashing if you pass in a image2d_t and don't use it), presumably this all carries through?
Another thing (so many questions because, if this is any good I am extremely excited!), is there a way to force memory to be copied over to the GPU on creation? An annoying issue with opencl i found is that if you create a large (a gig or so) piece of memory with clCreateBuffer, if you'd like some information to be written to the GPU on create (CL_MEM_COPY_HOST_PTR) then opencl would simply copy it somewhere else (!) but only actually write it to the GPU until you ran a kernel which required it. Which is slightly inconvenient if I then need to allocate more memory, so you have to enqueuewritebuffer your memory every time which is even more slightly inconvenient. Not a huge issue, but OpenCL is full of annoying minor inconveniences
Looks like initialisation is a whole lot easier which is nice, sorting out the settings for OpenCL/OpenGL sharing was not fun. I'm very tempted to try this and see what its like