Does all the OpenCL host code need to be within the same scope? I am having trouble having my host code in a C++ class, which initializes all buffers and bulids kernels in the constructor and has all setting of kernel arguments and enquqeing inside different functions for each kernel.
I have an instance of this class outside a loop and I call the functions which again enqueues the kernels from inside the loop. I do this to avoid duplication and hide all the ugly host code from the client.
However, when I do this I do not get the correct answer anymore and I also get totaly different answers on a 9800GT (close to the correct answer each time) and a GTX460 (random totally wrong answers each time) (sorry for using nVidia..I ask here since they don't seem so dedicated to OpenCL. And their forum is down...).
Before I had all the host code inside one single function which works and gives the same answer on both cards. But I want to clean it up a bit. I also use QtOpenCL, but that should not matter since it is just a fancy wrapper.