[AMD11.12] imageAtomicCompSwap not working

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);
	glBufferData(GL_TEXTURE_BUFFER,
	             sizeof(GLint)*bufferData.size(),
	             &bufferData[0],
	             GL_STATIC_DRAW);
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 (gmake and vs2010 projects are provided).

Fixed in 12.1, nice work!

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.