Reputation: 65
This GLSL source code compiles (using GL_COMPUTE_SHADER) and runs with no issue (only uses output image):
#version 460
layout (local_size_x = 16, local_size_y = 16) in;
layout (rgba8, binding = 3) uniform writeonly lowp image2D destTex;
void main() {
ivec2 pixel_coords = ivec2(gl_GlobalInvocationID.xy);
imageStore(destTex, pixel_coords, vec4(1.0, 0.0, 0.0, 1.0)); // Solid red
}
But if I add only two lines of code to allow for an input image, the following doesn't compile:
#version 460
layout (local_size_x = 16, local_size_y = 16) in;
layout (rgba8, binding = 1) uniform readonly lowp image2D srcTex;
layout (rgba8, binding = 3) uniform writeonly lowp image2D destTex;
void main() {
ivec2 pixel_coords = ivec2(gl_GlobalInvocationID.xy);
vec4 color = imageLoad(srcTex, pixel_coords);
imageStore(destTex, pixel_coords, color);
}
The output of the compiler is:
0(7) : error C0000: syntax error, unexpected $undefined, expecting "::" at token "<undefined>"
0(8) : error C1503: undefined variable "color"
Any ideas?
Upvotes: 1
Views: 472
Reputation: 2570
You seem to have a 'ZERO WIDTH SPACE' (U+200B) character (which is invisible) between the 'x' and the comma in imageLoad
. After erasing it, your code compiled fine for me.
Upvotes: 4