提交 0f30055d 编写于 作者: M Mr.doob

WebGLProgram: Flattened unrollLoops().

上级 c60e8a1c
......@@ -221,30 +221,34 @@ function includeReplacer( match, include ) {
}
function unrollLoops( string ) {
// Unroll Loops
var loopPattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;
var pattern = /#pragma unroll_loop[\s]+?for \( int i \= (\d+)\; i < (\d+)\; i \+\+ \) \{([\s\S]+?)(?=\})\}/g;
function unrollLoops( string ) {
function replace( match, start, end, snippet ) {
return string.replace( loopPattern, loopReplacer );
var unroll = '';
}
for ( var i = parseInt( start ); i < parseInt( end ); i ++ ) {
function loopReplacer( match, start, end, snippet ) {
unroll += snippet
.replace( /\[ i \]/g, '[ ' + i + ' ]' )
.replace( /UNROLLED_LOOP_INDEX/g, i );
var string = '';
}
for ( var i = parseInt( start ); i < parseInt( end ); i ++ ) {
return unroll;
string += snippet
.replace( /\[ i \]/g, '[ ' + i + ' ]' )
.replace( /UNROLLED_LOOP_INDEX/g, i );
}
return string.replace( pattern, replace );
return string;
}
//
function generatePrecision( parameters ) {
var precisionstring = "precision " + parameters.precision + " float;\nprecision " + parameters.precision + " int;";
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册