On Nov 25, Henry Gomersall modulated: > The OpenGL context is created independently of the OpenCL context and > exists in a different thread. I'm currently making no attempt to share > data between OpenGL and OpenCL - all the data passes via the CPU. >
How is this sharing via CPU done? Are you copying data into opengl vertex buffers or textures via opengl API calls? Are these calls done in the opengl thread at the right point in the rendering loop? At the very least, you need to do something to synchronize your reads of results from the opencl thread and your writes to the opengl thread. I would expect you'd copy opencl results into Python during the opencl thread (between kernel runs) and stick them in a synchronized Python structure to then pull them out and send to opengl from the opengl thread. > I'm finding that I'm getting substantial artifacts in the OpenGL > rendering. Specifically, I get a heavy flickering of the rendering - it > looks like e.g. certain line segments are not being drawn (it's a simple > line drawing program) for some frame. > Is the renderer using line vertices copied over from opencl results? Do the missing lines make sense as rendering a partially copied array? Also, are you using double-buffering in opengl so that only completely rendered frames will be swapped to the display? Otherwise, you could also see parts of the scene drawn or missing depending on when they happen relative to the vertical blanking period and buffer clearing. > Curiously, it doesn't break _every_ run. About 1 run in 10 works > perfectly, with no visual problems at all. I wonder if there is some > race condition causing a (setup?) problem. > This could be dumb luck that the workers get phase-locked and synchronized by accident. Karl _______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
