I’ve got a bug with a CUDA particle system that I’ve written. The particle system reads and writes particles to a gpu buffer. gl passes the address of the gpu buffer as a uniform to the vertex shader as an array of floats and the vertex shader indexes into the array using gl_InstanceID.
What’s happening is that the array as far as the shader is concerned is just zeros. I expect it to have the values generated from cuda.
Anyway I anticipate spending today trying to figure out what I’ve done wrong and thought I’d just ask what is the state of the art/ what what I should be doing. If it matters, I only care about 1070/Pascal on Win32 at the moment.
Here are some broad questions about bindless graphics.
-
Do I need to bind the gpu-pointer-uniform for every draw call? I thought I didn’t, but then if I look at BindlessApp.cpp, it resets the GPU pointer for every draw! Is this necessary?
-
Should I be using GL_UNIFORM_BUFFER or GL_SHADER_STORAGE_BUFFER as the buffer type?
-
Do I need to call glMakeBufferResident for every draw call? I don’t know what the rules are.
-
Do I have to make any memory fence calls between CUDA and GL?