Shader_Minifier icon indicating copy to clipboard operation
Shader_Minifier copied to clipboard

uninitialized variables can generate illegal glsl

Open csynth opened this issue 2 years ago • 1 comments

Very helpful project, thank you.

The code vec4 main() { vec4 bb; return bb; } minimizes to vec4 main(){return bb;}

The original is clearly bad code but according to the spec is legal with undefined results. The minimized version is not legal glsl and will not compile.

I had much more complicated (autogenerated) code where the result was well-defined despite the uninitialized variables. I don't think it worth posting that here, but could if it helped.

slightly related to https://github.com/laurentlb/Shader_Minifier/issues/153

csynth avatar Oct 15 '23 21:10 csynth

Thanks for the report, this is clearly a bug. No need to send more code.

(if no one else sends a PR before, I expect to work on it in a couple of months)

laurentlb avatar Oct 15 '23 21:10 laurentlb