Z01
04-30-2007, 07:08 PM
I'm using OpenGL in a multithreaded application. My shaders each have a lock so more than one thread cannot be changing a fragment program parameter at the same time. I basically:
*lock the shader
*bind it
*set its parameters (since another thread could have changed them, I always have to reset them)
*render with it
*unlock it
My question to the forum members is whether this is sufficient protection against multithreaded bugs in practice?
(eg. Could a second thread using the shader soon after the first thread released it, set its own parameters and this messes what the first thread was trying to do?)
*lock the shader
*bind it
*set its parameters (since another thread could have changed them, I always have to reset them)
*render with it
*unlock it
My question to the forum members is whether this is sufficient protection against multithreaded bugs in practice?
(eg. Could a second thread using the shader soon after the first thread released it, set its own parameters and this messes what the first thread was trying to do?)