  };
  
  
-diff -ur ../../glslunit.orig/compiler/utils.js glslunit/compiler/utils.js
+diff -ru ../../glslunit.orig/compiler/utils.js glslunit/compiler/utils.js
 --- ../../glslunit.orig/compiler/utils.js	2012-05-04 20:42:55.000000000 +0200
 +++ glslunit/compiler/utils.js	2015-07-12 09:02:18.657120680 +0200
 @@ -40,10 +40,10 @@

  * @param {!Object.<string, string>} libraryFiles A map of filenames to the
  *     contents of the file for library files.
  * @return {Error} The exception with a formatted message.
@@ -255,15 +328,33 @@
 glslunit.compiler.Preprocessor.FormatParseError_ = function(exception,
                                                             shaderType,
                                                             sourceMap,

+    var optimize = glsl_optimizer['cwrap'](
+        'optimize_glsl', 'string', [ 'string', 'number', 'number' ] );
+
+	var version = 2; // OpenGL ES3
+
+    vertexSourceCode =
+        parseDiagnostics( optimize( vertexSourceCode, version, 1 ),
+                          vertexSourceMap );
+
+    fragmentSourceCode =
+        parseDiagnostics( optimize( fragmentSourceCode, version, 0 ),
+                          fragmentSourceMap );
+
+    if (optimizationFailed)
