Skip to content

Commit 8cf91f4

Browse files
fix: Add deprecated method setOutputToTexture, and test
1 parent 7528559 commit 8cf91f4

File tree

6 files changed

+34
-22
lines changed

6 files changed

+34
-22
lines changed

bin/gpu-browser-core.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* GPU Accelerated JavaScript
66
*
77
* @version 2.0.0-rc.7
8-
* @date Sun Apr 21 2019 12:01:27 GMT-0400 (Eastern Daylight Time)
8+
* @date Sun Apr 21 2019 17:22:52 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -3814,7 +3814,7 @@ class Kernel {
38143814
this.constants = null;
38153815
this.constantTypes = null;
38163816
this.constantBitRatios = null;
3817-
this.hardcodeConstants = null;
3817+
this.hardcodeConstants = false;
38183818

38193819
this.canvas = null;
38203820

@@ -4075,6 +4075,7 @@ class Kernel {
40754075
module.exports = {
40764076
Kernel
40774077
};
4078+
40784079
},{"../input":24,"../utils":28}],12:[function(require,module,exports){
40794080
const fragmentShader = `__HEADER__;
40804081
precision highp float;
@@ -6803,7 +6804,7 @@ class WebGLKernel extends GLKernel {
68036804
break;
68046805
case 'Float':
68056806
case 'Number':
6806-
result.push(`float user_${name} = ${value}`);
6807+
result.push(`float user_${name} = ${ value % 1 === 0 ? value + '.0' : value }`);
68076808
break;
68086809
default:
68096810
throw new Error(`Param type ${type} not supported in WebGL`);
@@ -8442,7 +8443,7 @@ class WebGL2Kernel extends WebGLKernel {
84428443
break;
84438444
case 'Float':
84448445
case 'Number':
8445-
result.push(`highp float user_${ name } = ${ value }`);
8446+
result.push(`highp float user_${ name } = ${ value % 1 === 0 ? value + '.0' : value }`);
84468447
break;
84478448
default:
84488449
throw new Error(`Param type ${type} not supported in WebGL2`);
@@ -8727,7 +8728,6 @@ class WebGL2Kernel extends WebGLKernel {
87278728
module.exports = {
87288729
WebGL2Kernel
87298730
};
8730-
87318731
},{"../../texture":27,"../../utils":28,"../function-builder":7,"../web-gl/kernel":15,"./fragment-shader":17,"./function-node":18,"./vertex-shader":20}],20:[function(require,module,exports){
87328732
const vertexShader = `#version 300 es
87338733
precision highp float;

bin/gpu-browser-core.min.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* GPU Accelerated JavaScript
66
*
77
* @version 2.0.0-rc.7
8-
* @date Sun Apr 21 2019 12:01:30 GMT-0400 (Eastern Daylight Time)
8+
* @date Sun Apr 21 2019 17:22:54 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -18,7 +18,7 @@
1818
* GPU Accelerated JavaScript
1919
*
2020
* @version 2.0.0-rc.7
21-
* @date Sun Apr 21 2019 12:01:27 GMT-0400 (Eastern Daylight Time)
21+
* @date Sun Apr 21 2019 17:22:52 GMT-0400 (Eastern Daylight Time)
2222
*
2323
* @license MIT
2424
* The MIT License
@@ -3827,7 +3827,7 @@ class Kernel {
38273827
this.constants = null;
38283828
this.constantTypes = null;
38293829
this.constantBitRatios = null;
3830-
this.hardcodeConstants = null;
3830+
this.hardcodeConstants = false;
38313831

38323832
this.canvas = null;
38333833

@@ -4088,6 +4088,7 @@ class Kernel {
40884088
module.exports = {
40894089
Kernel
40904090
};
4091+
40914092
},{"../input":24,"../utils":28}],12:[function(require,module,exports){
40924093
const fragmentShader = `__HEADER__;
40934094
precision highp float;
@@ -6816,7 +6817,7 @@ class WebGLKernel extends GLKernel {
68166817
break;
68176818
case 'Float':
68186819
case 'Number':
6819-
result.push(`float user_${name} = ${value}`);
6820+
result.push(`float user_${name} = ${ value % 1 === 0 ? value + '.0' : value }`);
68206821
break;
68216822
default:
68226823
throw new Error(`Param type ${type} not supported in WebGL`);
@@ -8455,7 +8456,7 @@ class WebGL2Kernel extends WebGLKernel {
84558456
break;
84568457
case 'Float':
84578458
case 'Number':
8458-
result.push(`highp float user_${ name } = ${ value }`);
8459+
result.push(`highp float user_${ name } = ${ value % 1 === 0 ? value + '.0' : value }`);
84598460
break;
84608461
default:
84618462
throw new Error(`Param type ${type} not supported in WebGL2`);
@@ -8740,7 +8741,6 @@ class WebGL2Kernel extends WebGLKernel {
87408741
module.exports = {
87418742
WebGL2Kernel
87428743
};
8743-
87448744
},{"../../texture":27,"../../utils":28,"../function-builder":7,"../web-gl/kernel":15,"./fragment-shader":17,"./function-node":18,"./vertex-shader":20}],20:[function(require,module,exports){
87458745
const vertexShader = `#version 300 es
87468746
precision highp float;

bin/gpu-browser.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* GPU Accelerated JavaScript
66
*
77
* @version 2.0.0-rc.7
8-
* @date Sun Apr 21 2019 12:01:28 GMT-0400 (Eastern Daylight Time)
8+
* @date Sun Apr 21 2019 17:22:52 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -8578,7 +8578,7 @@ class Kernel {
85788578
this.constants = null;
85798579
this.constantTypes = null;
85808580
this.constantBitRatios = null;
8581-
this.hardcodeConstants = null;
8581+
this.hardcodeConstants = false;
85828582

85838583
this.canvas = null;
85848584

@@ -8839,6 +8839,7 @@ class Kernel {
88398839
module.exports = {
88408840
Kernel
88418841
};
8842+
88428843
},{"../input":25,"../utils":29}],13:[function(require,module,exports){
88438844
const fragmentShader = `__HEADER__;
88448845
precision highp float;
@@ -11567,7 +11568,7 @@ class WebGLKernel extends GLKernel {
1156711568
break;
1156811569
case 'Float':
1156911570
case 'Number':
11570-
result.push(`float user_${name} = ${value}`);
11571+
result.push(`float user_${name} = ${ value % 1 === 0 ? value + '.0' : value }`);
1157111572
break;
1157211573
default:
1157311574
throw new Error(`Param type ${type} not supported in WebGL`);
@@ -13206,7 +13207,7 @@ class WebGL2Kernel extends WebGLKernel {
1320613207
break;
1320713208
case 'Float':
1320813209
case 'Number':
13209-
result.push(`highp float user_${ name } = ${ value }`);
13210+
result.push(`highp float user_${ name } = ${ value % 1 === 0 ? value + '.0' : value }`);
1321013211
break;
1321113212
default:
1321213213
throw new Error(`Param type ${type} not supported in WebGL2`);
@@ -13491,7 +13492,6 @@ class WebGL2Kernel extends WebGLKernel {
1349113492
module.exports = {
1349213493
WebGL2Kernel
1349313494
};
13494-
1349513495
},{"../../texture":28,"../../utils":29,"../function-builder":8,"../web-gl/kernel":16,"./fragment-shader":18,"./function-node":19,"./vertex-shader":21}],21:[function(require,module,exports){
1349613496
const vertexShader = `#version 300 es
1349713497
precision highp float;

bin/gpu-browser.min.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* GPU Accelerated JavaScript
66
*
77
* @version 2.0.0-rc.7
8-
* @date Sun Apr 21 2019 12:01:30 GMT-0400 (Eastern Daylight Time)
8+
* @date Sun Apr 21 2019 17:22:54 GMT-0400 (Eastern Daylight Time)
99
*
1010
* @license MIT
1111
* The MIT License
@@ -18,7 +18,7 @@
1818
* GPU Accelerated JavaScript
1919
*
2020
* @version 2.0.0-rc.7
21-
* @date Sun Apr 21 2019 12:01:28 GMT-0400 (Eastern Daylight Time)
21+
* @date Sun Apr 21 2019 17:22:52 GMT-0400 (Eastern Daylight Time)
2222
*
2323
* @license MIT
2424
* The MIT License
@@ -8591,7 +8591,7 @@ class Kernel {
85918591
this.constants = null;
85928592
this.constantTypes = null;
85938593
this.constantBitRatios = null;
8594-
this.hardcodeConstants = null;
8594+
this.hardcodeConstants = false;
85958595

85968596
this.canvas = null;
85978597

@@ -8852,6 +8852,7 @@ class Kernel {
88528852
module.exports = {
88538853
Kernel
88548854
};
8855+
88558856
},{"../input":25,"../utils":29}],13:[function(require,module,exports){
88568857
const fragmentShader = `__HEADER__;
88578858
precision highp float;
@@ -11580,7 +11581,7 @@ class WebGLKernel extends GLKernel {
1158011581
break;
1158111582
case 'Float':
1158211583
case 'Number':
11583-
result.push(`float user_${name} = ${value}`);
11584+
result.push(`float user_${name} = ${ value % 1 === 0 ? value + '.0' : value }`);
1158411585
break;
1158511586
default:
1158611587
throw new Error(`Param type ${type} not supported in WebGL`);
@@ -13219,7 +13220,7 @@ class WebGL2Kernel extends WebGLKernel {
1321913220
break;
1322013221
case 'Float':
1322113222
case 'Number':
13222-
result.push(`highp float user_${ name } = ${ value }`);
13223+
result.push(`highp float user_${ name } = ${ value % 1 === 0 ? value + '.0' : value }`);
1322313224
break;
1322413225
default:
1322513226
throw new Error(`Param type ${type} not supported in WebGL2`);
@@ -13504,7 +13505,6 @@ class WebGL2Kernel extends WebGLKernel {
1350413505
module.exports = {
1350513506
WebGL2Kernel
1350613507
};
13507-
1350813508
},{"../../texture":28,"../../utils":29,"../function-builder":8,"../web-gl/kernel":16,"./fragment-shader":18,"./function-node":19,"./vertex-shader":21}],21:[function(require,module,exports){
1350913509
const vertexShader = `#version 300 es
1351013510
precision highp float;

src/backend/kernel.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,12 @@ class Kernel {
345345
return this;
346346
}
347347

348+
setOutputToTexture(flag) {
349+
utils.warnDeprecated('method', 'setOutputToTexture', 'setPipeline');
350+
this.pipeline = flag;
351+
return this;
352+
}
353+
348354
/**
349355
* Set to immutable
350356
* @param flag

test/internal/deprecated.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,9 @@ test('Kernel.getWebGl', () => {
9090
});
9191
assert.equal(kernel.getWebGl(), context);
9292
});
93+
94+
test('Kernel.setOutputToTexture', () => {
95+
const kernel = new Kernel(`function() {}`);
96+
kernel.setOutputToTexture(true);
97+
assert.equal(kernel.pipeline, true);
98+
});

0 commit comments

Comments
 (0)