>> Saturday, September 17, 2011
I've spent the last week coding a routine for pick selection, which determines which 3-D object in the model corresponds to the user's mouse click. Geometrically, the process involves ray-triangle intersection, and I've been focusing on the Möller-Trumbore method. 3-D applications generally don't test every triangle in the model at once, but I figured this would be a perfect application to demonstrate OpenGL-OpenCL interoperability.
It's been hard going. First of all, I made the mistake of upgrading Ubuntu 10.10 to version 11.4. When I did this, every call to clCreateFromGLBuffer returned a CL_INVALID_GL_OBJECT error. Eventually, the error went away after I reinstalled the AMD driver, updated the AMD APP SDK, and disabled the Unity interface.
But when I implement the Möller-Trumbore method in an OpenCL kernel, I get the strangest error. Work Groups 0 and 18 always produce the same selection result, even though they're analyzing different sets of triangles. The same holds true for Groups 1 and 19 and Groups 2 and 20. The only reason I can think of is that my GPU has 18 compute units. But this shouldn't matter; work-groups are supposed to operate independently of one another, no matter which compute unit they occupy. Weird, weird, weird...