- Removes comments
- Removes unnecessary spaces, tabs, line breaks
- Removes unnecessary zeroes in numbers (floats, ints, octals, hex)
- Inserts "\n" around #macros to keep all the code on a single line
Test shader:
#version 300 es // webgl2 precision mediump float; uniform vec3 light; in vec3 v_position; in vec4 v_color; out vec4 c;\n #define PI 3\n #define 2PI 7\n void main() { /* compute fragment multiline comment */ vec4 testFloats = vec4(010.00, 01.1200, 0.02030, 00.00); vec4 testInts = vec4(0, 1, 100, 10010); int testOctal = 0010; int testHex = 0x001F; c = vec4( v_color.rgb * ( max(dot(light, normalize(cross(dFdx(v_position), dFdy(v_position)))), 0.0) // ambient light + 0.200 // diffuse light ), 1 ); }