#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);
}
So, I have a shader storage buffer containing as many ‘entry’ values as the buffer can hold when bound.
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
Anytime that happens, it’s the driver’s fault. There should be nothing you can do with a shader that causes it to emit a link failure and not update the info-log.
@Danielkr:
make sure you try to read the info log straight after linking without an additional validate in between.
Validate overwrites the info log message, which may be a reason why you get an empty log message.