AnsweredAssumed Answered

imageAtomicAdd on R16I textures

Question asked by peppercat on Mar 27, 2015
Latest reply on Mar 27, 2015 by peppercat

In my application I use single-channel signed integer texture of the format R16I to store data. Attempting to use imageAtomicAdd() on the image the texture is bound to fails, with debug output as:


Compute shader failed to compile with the following errors:

ERROR: 0:23: error(#370) Missing or invalid layout qualifier for image variable

ERROR: error(#273) 1 compilation errors.  No code generated


(Apologies, I don't know how to format text as code here).


Changing the format in the layout() to r32i or removing the imageAtomicAdd() use results in a successful compilation.


As far as I can read in the OpenGL specification, there is no restriction on imageAtomicAdd() (or any other image functions) based on format.


Basic test shader:


#version 430 core


layout(binding = 1, r16i) uniform iimage2D sampleTexture; //fail

//layout(binding =1, r32i) uniform iimage2D sampleTexture; //success


void main(void){

ivec2 pix = ivec2(gl_GlobalInvocationID.xy);

  imageAtomicAdd(sampleTexture, pix, 1); //if this is commented out/removed, success