Shader_Minifier
Shader_Minifier copied to clipboard
Minify and obfuscate GLSL or HLSL code
Input ```glsl void main() { if (x) { y += 1.; } else { y += 2.; } } ``` Current output: ```glsl void main(){y=x?y+1.:y+2.;} ``` I would expect the...
```glsl void foo(float arg) { float x=arg; x*=x*x*x*x; return vec3(0); } ``` We should detect that the value of `x` is unused.
Input: ```glsl float foo(float x) { float color = 0.; color=2.; return color/4.; } ``` Current output: ```glsl float foo(float x) { x=2.; return x/4.; } ```
Input: ```glsl float foo() { vec2 t3b=vec2(26,20),continuous=vec2(100); t3b=vec2(13,3); f(t3b, continuous); return f(t3b, continuous); } ``` Current output: ```glsl float foo() { vec2 t3b=vec2(26,20),continuous=vec2(100); t3b=vec2(13,3); f(t3b,continuous); return f(t3b,continuous); } ``` The...
We could detect and remove unused global variables. e.g. ```glsl int foo; vec3 bar = vec3(1); ```
If new line characters are stripped, shader errors (on windows/nvidia) become very hard to track.  I propose an option `--no-remove-newline`, which would allow easier spotting of issues.
Hi, it's me again (sorry ._.) The following shader should be valid (validates using glslangValidator; also compare https://www.shadertoy.com/view/lfjcWt) ```frag #version 450 out vec4 out_color; uniform float t; void main() {...
Ok this one is kinda obscure to track down - I'm using shader_minifier v1.4.0. Minifying the shader ```frag #version 450 out vec3 v; void main() { vec3 y; for (int...
Got this error ``` System.Exception: Parse error: Error in B:\Place.glsl: Ln: 18 Col: 46 layout(points,invocations=MAX_ROTATIONS) in; ^ Expecting: Type qualifier, identifier, 'layout' or 'struct' ```
net8.0, one fsproj per dir, with same name as dir, works on my machine