Login  Register

Re: JOCL texture generation

Posted by Wade Walker on Mar 20, 2014; 2:36am
URL: https://forum.jogamp.org/JOCL-texture-generation-tp4031853p4032002.html

OK, now the story gets more interesting :) I installed the Intel OpenCL driver on my PC, set the demo to pick the Intel OpenCL device, and ran it. It crashes the JVM when the OpenCL kernel is invoked. But that actually makes sense -- the GL context is from my Nvidia card, and the CL context is from my CPU, and the two don't physically share any memory chips, so I'm handing the Intel OpenCL driver an unreachable pointer to GPU memory, which causes a crash on write.

So wait, then how did the Intel OpenCL driver work on my Mac? It's got Nvidia graphics too, not Intel integrated graphics. Aha, but the Nvidia GeForce 320M on the MacBook Air is a low-end card that doesn't have dedicated video memory, it shares memory with the CPU. So Intel CL-GL sharing works fine, because it's all the same memory.

And it turns out Nvidia GL-CL sharing wasn't working on the Mac after all, it's just that the Mac will give you a pointer to the same video memory across multiple runs. Since I wasn't initializing the texture to anything, the Nvidia runs would get the texture from when I ran on the CPU, which was still correct-looking. Initializing the texture shows that the GPU isn't successfully writing it from OpenCL.

So, next steps are still to try this in C++, and to try this on an AMD card (I've got one lying around, it's just a pain to install in my machine since I have to manually remove the drivers afterwards).