Hi there,
I'm working with OpenGL 4.3 (GTX 680, driver version 306.63) and want to use the Shader Storage Buffers atomically.
Using the following shaders, the linking fails but I do not have a clue, why that is and how to fix it:
Vertex:
Code :#version 430 layout(location = 0) in vec3 vertexPos; void main() { gl_Position.xyz = vertexPos; }
Fragment:
So, I have a shader storage buffer containing as many 'entry' values as the buffer can hold when bound.Code :#version 430 in vec4 gl_FragCoord; out vec4 gl_FragColor; uniform unsigned int width; layout(binding = 1) buffer List { unsigned int entry[]; }list; void main(void) { uvec2 p = uvec2(gl_FragCoord.xy); uint index = p.x + p.y*width; unsigned int a = 5; atomicExchange(list.entry[index], a); }
Every shader calculates the index of where to write into the buffer using linearizing the fragment position.
Then, I want to replace the value in the buffer with 'a' atomically.
When I write 'list.entry[index] = a', it links and works fine.
But when I use the atomic operation, it compiles(!) but fails to link with no message.
I need the atomic operation for an lock free list implementation.
I have not tried this with compute shaders as I need the data generated by the rasterizer.
The example above is the most minimalistic one producing the error.
Can anyone help me with this? Is there something I did wrong or missed?
Thanks in advance,
daniel