laurentlb/shader-minifier

Incorrect parsing behavior when different macro definitions affect the same computation result.

lemoon opened this issue · 0 comments

lemoon commented
precision highp float;
varying vec2 v_texcoordOut;
uniform sampler2D s_texture;
uniform float u_degree;
uniform float u_degree2;

void main(void)
{
#ifdef ALPHA_1
    float alpha = 1.0;
#else
    float alpha = 0.5;
#endif
    gl_FragColor = vec4(texture2D(s_texture, v_texcoordOut).rgb,alpha);
}

mono "$script_dir/shader_minifier.exe" -v --preserve-externals --field-names stpq -o res.h input.frag

// Generated with Shader Minifier 1.3.6 (https://github.com/laurentlb/Shader_Minifier/)
#ifndef RES_H_
# define RES_H_

const char *Basic_frag =
 "precision highp float;varying vec2 v_texcoordOut;"
 "uniform sampler2D s_texture;"
 "uniform float u_degree,u_degree2;"
 "void main()"
 "{"
   "\n#ifdef ALPHA_1\n"
   "\n#else\n"
   "\n#endif\n"
   "gl_FragColor=vec4(texture2D(s_texture,v_texcoordOut).stp,.5);"
 "}";

#endif // RES_H_