View Full Version : [AMD11.12] imageAtomicCompSwap not working

01-21-2012, 03:52 AM
The imageAtomicCompSwap doesn't seem to be working.
I create a texture buffer like so (all texels set to value -1)

// build buffer
std::vector<GLint> bufferData(ELEM_CNT,-1);
glBindBuffer(GL_TEXTURE_BUFFER, buffer);
glBindBuffer(GL_TEXTURE_BUFFER, 0);

// build texture
glBindTexture(GL_TEXTURE_BUFFER, texture);
glTexBuffer(GL_TEXTURE_BUFFER, GL_R32I, buffer);
I expect the following shader to set texel number i to value i.

#version 420 core

layout(r32i) coherent uniform iimageBuffer imgData;

void main() {
imageAtomicCompSwap(imgData, gl_VertexID, -1, gl_VertexID);

However, it does not, values remain at -1. Replacing imageAtomicCompSwap by imageAtomicExchange gives the correct output.

Code can be downloaded here (https://github.com/jdupuy/imageAtomicCompSwap/zipball/master) (gmake and vs2010 projects are provided).

01-26-2012, 12:13 PM
Fixed in 12.1, nice work!