55 * GPU Accelerated JavaScript
66 *
77 * @version 1.0.0-rc.10
8- * @date Fri Dec 15 2017 20:55:34 GMT+0300 (MSK )
8+ * @date Mon Dec 18 2017 11:09:59 GMT-0500 (EST )
99 *
1010 * @license MIT
1111 * The MIT License
@@ -1522,8 +1522,8 @@ module.exports = function () {
15221522 this . _canvas = null ;
15231523 this . _webGl = null ;
15241524 this . threadDim = null ;
1525- this . floatTextures = null ;
1526- this . floatOutput = null ;
1525+ this . floatTextures = true ;
1526+ this . floatOutput = true ;
15271527 this . floatOutputForce = null ;
15281528 this . addFunction = null ;
15291529 this . functions = null ;
@@ -2735,11 +2735,11 @@ function ensureIndentifierType(paramName, expectedType, ast, funcParam) {
27352735 var start = ast . loc . start ;
27362736
27372737 if ( ! isIdentifierKernelParam ( paramName , funcParam ) && expectedType !== 'float' ) {
2738- throw 'Error unexpected identifier ' + paramName + ' on line ' + start . line ;
2738+ throw new Error ( 'Error unexpected identifier ' + paramName + ' on line ' + start . line ) ;
27392739 } else {
27402740 var actualType = funcParam . paramTypes [ funcParam . paramNames . indexOf ( paramName ) ] ;
27412741 if ( actualType !== expectedType ) {
2742- throw 'Error unexpected identifier ' + paramName + ' on line ' + start . line ;
2742+ throw new Error ( 'Error unexpected identifier ' + paramName + ' on line ' + start . line ) ;
27432743 }
27442744 }
27452745}
@@ -2813,17 +2813,18 @@ module.exports = function (_KernelBase) {
28132813 value : function validateOptions ( ) {
28142814 var isReadPixel = utils . isFloatReadPixelsSupported ( ) ;
28152815 if ( this . floatTextures === true && ! utils . OES_texture_float ) {
2816- throw 'Float textures are not supported on this browser' ;
2816+ throw new Error ( 'Float textures are not supported on this browser' ) ;
28172817 } else if ( this . floatOutput === true && this . floatOutputForce !== true && ! isReadPixel ) {
2818- throw 'Float texture outputs are not supported on this browser' ;
2818+ console . warn ( 'Float texture outputs are not supported on this browser' ) ;
2819+ this . floatOutput = false ;
28192820 } else if ( this . floatTextures === null && ! isReadPixel && ! this . graphical ) {
28202821 this . floatTextures = true ;
28212822 this . floatOutput = false ;
28222823 }
28232824
28242825 if ( ! this . output || this . output . length === 0 ) {
28252826 if ( arguments . length !== 1 ) {
2826- throw 'Auto output only supported for kernels with only one input' ;
2827+ throw new Error ( 'Auto output only supported for kernels with only one input' ) ;
28272828 }
28282829
28292830 var argType = utils . getArgumentType ( arguments [ 0 ] ) ;
@@ -2832,7 +2833,7 @@ module.exports = function (_KernelBase) {
28322833 } else if ( argType === 'Texture' ) {
28332834 this . output = arguments [ 0 ] . output ;
28342835 } else {
2835- throw 'Auto output not supported for input type: ' + argType ;
2836+ throw new Error ( 'Auto output not supported for input type: ' + argType ) ;
28362837 }
28372838 }
28382839
@@ -2843,11 +2844,12 @@ module.exports = function (_KernelBase) {
28432844
28442845 if ( this . graphical ) {
28452846 if ( this . output . length !== 2 ) {
2846- throw 'Output must have 2 dimensions on graphical mode' ;
2847+ throw new Error ( 'Output must have 2 dimensions on graphical mode' ) ;
28472848 }
28482849
28492850 if ( this . floatOutput ) {
2850- throw 'Cannot use graphical mode and float output at the same time' ;
2851+ this . floatOutput = false ;
2852+ console . warn ( 'Cannot use graphical mode and float output at the same time' ) ;
28512853 }
28522854
28532855 this . texSize = utils . clone ( this . output ) ;
@@ -2911,12 +2913,12 @@ module.exports = function (_KernelBase) {
29112913 if ( ! gl . getShaderParameter ( vertShader , gl . COMPILE_STATUS ) ) {
29122914 console . log ( compiledVertShaderString ) ;
29132915 console . error ( 'An error occurred compiling the shaders: ' + gl . getShaderInfoLog ( vertShader ) ) ;
2914- throw 'Error compiling vertex shader' ;
2916+ throw new Error ( 'Error compiling vertex shader' ) ;
29152917 }
29162918 if ( ! gl . getShaderParameter ( fragShader , gl . COMPILE_STATUS ) ) {
29172919 console . log ( compiledFragShaderString ) ;
29182920 console . error ( 'An error occurred compiling the shaders: ' + gl . getShaderInfoLog ( fragShader ) ) ;
2919- throw 'Error compiling fragment shader' ;
2921+ throw new Error ( 'Error compiling fragment shader' ) ;
29202922 }
29212923
29222924 if ( this . debug ) {
@@ -3318,7 +3320,7 @@ module.exports = function (_KernelBase) {
33183320 break ;
33193321 }
33203322 default :
3321- throw 'Input type not supported (WebGL): ' + value ;
3323+ throw new Error ( 'Input type not supported (WebGL): ' + value ) ;
33223324 }
33233325 this . argumentsLength ++ ;
33243326 }
@@ -4254,6 +4256,15 @@ var _systemEndianness = function () {
42544256
42554257var _isFloatReadPixelsSupported = null ;
42564258
4259+ var _isMixedIdentifiersSupported = function ( ) {
4260+ try {
4261+ new Function ( 'let i = 1; const j = 1;' ) ( ) ;
4262+ return true ;
4263+ } catch ( e ) {
4264+ return false ;
4265+ }
4266+ } ( ) ;
4267+
42574268var Utils = function ( _UtilsCore ) {
42584269 _inherits ( Utils , _UtilsCore ) ;
42594270
@@ -4409,6 +4420,11 @@ var Utils = function (_UtilsCore) {
44094420
44104421 return _isFloatReadPixelsSupported ;
44114422 }
4423+ } , {
4424+ key : 'isMixedIdentifiersSupported' ,
4425+ value : function isMixedIdentifiersSupported ( ) {
4426+ return _isMixedIdentifiersSupported ;
4427+ }
44124428 } , {
44134429 key : 'dimToTexSize' ,
44144430 value : function dimToTexSize ( opt , dimensions , output ) {
0 commit comments