Hybrid View

imageStore stops working after a number of compute shader invocations.

I have a compute shader that I call iteratively as part of a larger algorithm. I'm currently getting strange behaviour that is either caused by imageStore not writing to the texture, or uniform variables not updating between iterations (since the texture output is dependant on the uniform value). Considering I do not get any errors when setting the uniforms, and my previous driver issues with imageStore, I'm leaning towards this being related to imageStore.

For the past few days I've tried to narrow down the part of the code that causes the issue, but I cannot find anythign concrete. All I can say is that if i try to write a value that at any point was derived from a uniform variable, eventually imageStore stops writing to the texture.

I run this on Ubunutu 12.04 and I'm fairly sure this is driver related since my previous Nvidia 310.19 drivers had imageStore corrupting adjacent pixel values, and since updating to the 325.15 drivers, it correctly writes the values some of the time.

I'm using glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT ); to ensure my image operations are complete, and am 99.9% certain that my glGetTexImage() code to read the textures is correct, as I have been using it for a few months on previous compute shaders without issue.

I'm at a loss right now, because all of my code in the shader runs fine in isolation, but when I put it all together, I get these issues. It is a fairly large shader program (~800 lines) with lots of branching and conditionals which I've read cause strange behaviour sometimes.