1. Attached file is the source code;
2. build the source code, "gcc -o compileshader compileshader.c -lX11 -lepoxy";
3. run executable file, "./compileshader", mesa explicitly reports "invalid input layout qualifier used", compute shader compiling fails.
1. I am nearly sure that this issue is not mesa bug. It is possible that my shader is not correct, but I could not find the root cause, so I file the bug to get some help.
2. Compute shader is as below, defines a user-defined function, with image type parameter, if uses "in" key to qualify the parameter, error happens, but if remove "in" and "out" keys, shader compiling successfully. Quotes OpenGL ES GLSL 3.1 spec section 6.1.1, "A function parameter declared with no such qualifier(in, out, inout) means the same thing as specifying in". Here explicitly specifies "in" key, why reports an error.
#version 310 es
layout(local_size_x=1, local_size_y=1, local_size_z=1) in;
layout(r32ui, binding = 0) uniform readonly highp uimage2D uImage_1;
layout(r32ui, binding = 1) uniform writeonly highp uimage2D uImage_2;
void dataCopy(in readonly highp uimage2D src, out writeonly highp uimage2D dst, ivec2 pos)
uvec4 value = imageLoad(src, pos);
imageStore(dst, pos, value);
dataCopy(uImage_1, uImage_2, ivec2(gl_LocalInvocationID.xy));
Created attachment 140273 [details]
The problem is dst is marked as an "out" parameter of the function. sampler variables cannot be assigned, so it's impossible for it to be an out parameter. Deleting "out" allows the shader to compile.
Sadly, the compiler error message is useless for debugging that problem.
(In reply to Ian Romanick from comment #2)
> sampler variables cannot be assigned, so it's impossible for it to be an out
FWIW they can be with bindless. But then the expectation would be that the function does something like "dst = src" or something.