GLSL compute shader incompatibilities

Discussion created by adik on Mar 25, 2015
Latest reply on Apr 29, 2015 by adik


in my project, I use GLSL compute shaders (version 430) and I have two problems with the application when running on AMD Radeon R9 270X graphics card. I tried with Catalyst 14.12 and 15.3 drivers. Both versions surffered from both problems.


First, I store my data in SSBOs (Shader Storage Buffer Object) and before the computation I clear some of them using glClearBufferData function. One of the buffers stores a hashing structure, where each entry takes 3 uints (12 bytes), and I use the std430 layout when writting and reading the data, so that the entries are tighly packed. The problem is when I want to clear the buffer as mentioned. I supply the glClearBufferData function with arguments for 3-channel data (internalformat = GL_RGB32UI, format = GL_RGB_INTEGER, type = GL_UNSIGNED_INT) and I got a GL_INVALID_VALUE error. An array of three ints as clear value is also supplied.


Second, in the hashing compute shader I use atomicCompSwap function, which does not behave on my AMD as it would follow the OpenGL documentation. The problem is with the order of the second and third parameter (compare and data). The function seems to work properly only when I swap the order of those two parameters, which is in confict with the OpenGL documentation and also with the ARB specification for SSBOs.


I have workarounds for both these problems, but any of them does not occur when I run the application on NVIDIA GTX 580 card.


Thanks for your interest,