File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,10 +35,32 @@ var functionNode_webgl = (function() {
3535 gpu = inNode . gpu ;
3636 jsFunctionString = inNode . jsFunctionString ;
3737 inNode . webglFunctionString_array = ast_generic ( inNode . getJS_AST ( ) , [ ] , inNode ) ;
38- inNode . webglFunctionString = inNode . webglFunctionString_array . join ( "" ) . trim ( ) ;
38+ inNode . webglFunctionString = webgl_regex_optimize (
39+ inNode . webglFunctionString_array . join ( "" ) . trim ( )
40+ ) ;
3941 return inNode . webglFunctionString ;
4042 }
4143
44+ var DECODE32_ENCODE32 = / d e c o d e 3 2 \( \s + e n c o d e 3 2 \( / g;
45+ var ENCODE32_DECODE32 = / e n c o d e 3 2 \( \s + d e c o d e 3 2 \( / g;
46+
47+ ///
48+ /// Function: webgl_regex_optimize
49+ ///
50+ /// [INTERNAL] Takes the near final webgl function string, and do regex search and replacments.
51+ /// For voodoo optimize out the following
52+ ///
53+ /// - decode32(encode32(
54+ /// - encode32(decode32(
55+ ///
56+ function webgl_regex_optimize ( inStr ) {
57+ return inStr
58+ . replace ( DECODE32_ENCODE32 , "((" )
59+ . replace ( ENCODE32_DECODE32 , "((" )
60+ ;
61+ }
62+
63+
4264 /// the AST error, with its location. To throw
4365 ///
4466 /// @TODO : add location support fpr the AST error
You can’t perform that action at this time.
0 commit comments