_ScreenTexture isn't checked properly
In this file: https://github.com/not-fl3/macroquad/blob/master/src/quad_gl.rs#L640 macroquad "checks" if _ScreenTexture is present in the file, not actually if it's defined or not, this causing a bug where I have a shader as follows:
#version 140
in lowp vec4 color;
in lowp vec2 uv;
// Set by macroquad
uniform sampler2D Texture;
// uniform sampler2D _ScreenTexture;
void main() {
gl_FragColor = color * texture2D(Texture, uv) ;
}
Causing the _ScreenTexture to be applied erroneously.
This is tested by commenting out 640 and forcibly setting wants_screen_texture to false, fixing the bug.
I will try to make a PR to fix this
Not really seeing any metadata output from the shader compiler that could give us a hint if _ScreenTexture was commented or not, since the shader compiler looks to be external
IDK if you'd want to write your own parser? Since /* ... */ and // ... are valid comments in glsl
(https://www.opengl.org/sdk/docs/tutorials/TyphoonLabs/Chapter_2.pdf page 4)
Maybe glGetUniformLocation will do the trick?
It would be quite a lot of platform(opengl/metal) specific code and I am not sure if it would be worth it.