It seems there is a limitation in terms of buffer memory size with the nVidia drivers, in that although I can successfully allocate more than 512MB for a buffer object, running my shaders will always result in a GL_INVALID_VALUE if such large buffers are bound. The simple fact that the buffers are bound is sufficient to trigger the error - even if the shader that is executed does not write to the memory.
Say for instance that I allocate a buffer of size=641MB this way:
Following which I do:Code :glBindBufferARB(GL_TEXTURE_BUFFER, bufferid); glBufferDataARB(GL_TEXTURE_BUFFER, size, NULL, GL_STATIC_DRAW); // this buffer may be resized from times to times glBindBufferARB(GL_TEXTURE_BUFFER, 0);
I then bind the shader image normally:Code :glBindTexture(GL_TEXTURE_BUFFER, textureId); glTexBufferARB(GL_TEXTURE_BUFFER, GL_R32UI, bufferid); glBindTexture(GL_TEXTURE_BUFFER, 0);
Code :glBindImageTexture(1, textureId, 0, GL_FALSE, 0, GL_READ_WRITE, GL_R32UI );
and the shader code that I am running afterwards looks like this:
Code :layout(r32ui) coherent uniform uimageBuffer u_Records; imageStore( u_Records, int(index) , uvec4(0) ); // index is a value going from 0 to 6350*6350-1, clearing only the first 161290000 bytes of memory.
In fact, even if I don't write any value in the shader (eg. the shader does nothing), I am still getting a GL_INVALID_VALUE error, once my draw call has been executed (only then).
Is there a limitation with image buffers, with a size greater than 512MB?