evanw / glslx

A GLSL type checker, code formatter, and minifier for WebGL
http://evanw.github.io/glslx/
MIT License
413 stars 28 forks source link

Export varying in the renaming table #24

Open zebontheweb opened 3 weeks ago

zebontheweb commented 3 weeks ago

Hi, we love your project, but it does not work out of the box if you minify vertex shader and fragment shader independantly because varying are renamed differently.

Would it be possible to export the renaming of varying in the output ?

Thanks

zebontheweb commented 3 weeks ago

My proposed solution is not ideal as is. to be unbreakable, the ability to input an existing renaming table is needed as well.

var VSoptimizedSource = JSON.parse(GLSLX.compile(vertexShaderSource, options).output); var FSoptimizedSource = JSON.parse(GLSLX.compile(fragmentShaderSource, options, VSoptimizedSource.renaming).output);