Hi, I’m trying to store the z and the colors of every fragments in a 2D image array, to sort my fragments and applying the alpha blending in this order : bottom to top layer.
So the code looks lile this :
#version 420 core
#extension GL_EXT_shader_image_load_store : enable
uniform layout(size1x32) uimage2D abufferCounterImg;
uniform layout(size1x32) image2DArray adepthbufferImg;
uniform layout(size4x32) image2DArray abufferImg;
inout vec4 color;
vec4 backgroundColor = vec4(0, 0, 0, 1);
void main() {
ivec2 coords = ivec2 (gl_FragCoord.xy);
float z = gl_FragCoord.z;
int nbFrag = int(imageLoad(abufferCounterImg, coords).r);
int fragPos = 0;
while (fragPos < nbFrag && z >= imageLoad(adepthbufferImg, vec3(coords, fragPos)).r)
fragPos++;
int i = nbFrag;
while(i > fragPos) {
float adepthbuffervalue = imageLoad(adepthbufferImg, vec3(coords, i-1)).r;
vec4 abuffervalue = imageLoad(abufferImg, vec3(coords, i-1));
imageStore(adepthbufferImg, vec3(coords, i), adepthbuffervalue);
imageStore(abufferImg, vec3(coords, i), abuffervalue);
i--;
}
imageStore(adepthbufferImg, vec3(coords, fragPos), z);
imageStore(abufferImg, vec3(coords, fragPos), color);
nbFrag++;
imageStore(abufferCounterImg, coords, nbFrag);
vec4 finalColor = backgroundColor;
for (i = 0; i < nbFrag; i++) {
vec4 currentColor = imageLoad(abufferImg, vec3(coords, i));
finalColor = currentColor * currentColor.a + finalColor * (1 - currentColor.a);
}
color = finalColor;
}
But I’v a bunch of errors that tells me that the functions imageLoad and imageStore doesn’t exists :
error(#202) No matching overload function found imageLoad.
error(#202) No matching overload function found imageStore.
I really don’t understand, I’m sure my driver support opengl 4.2 (AMD drivers on windows) and my image’s declarations are correct so why he can’t find the corresponding function ?