gpu.js/test/issues/313-variable-lookup.js
Robert Plummer b2df0ab604 fix #316
Change `HTMLImageArray` render strategy to `gl.NEAREST`, like all the others
Let `WebGL2FunctionNode` extend `WebGLFunctionNode` and lighten
Remove all the different html pages associated with tests, and just use one file to handle them and use qunit for filtering them
Bump version number
2018-06-12 14:07:41 -04:00

39 lines
1.1 KiB
JavaScript

(function() {
function test(mode) {
var gpu = new GPU({ mode: mode });
function mult2(scale) {
return 2*scale;
}
var render1 = gpu.createKernel(function(input) {
return (mult2(input) + mult2(input*2) + mult2(input*1)) // RIGHT
})
.setOutput([1])
.setFunctions([mult2]);
var render2 = gpu.createKernel(function(input) {
return (mult2(input) + mult2(input*2) + mult2(input)); // WRONG
})
.setOutput([1])
.setFunctions([mult2]);
QUnit.assert.equal(render1(1)[0], 8, 'render1 equals 8');
QUnit.assert.equal(render2(1)[0], 8, 'render2 equals 8');
}
QUnit.test('Issue #313 Mismatch argument lookup - auto', () => {
test();
});
QUnit.test('Issue #313 Mismatch argument lookup - gpu', () => {
test('gpu');
});
QUnit.test('Issue #313 Mismatch argument lookup - webgl', () => {
test('webgl');
});
QUnit.test('Issue #313 Mismatch argument lookup - webgl2', () => {
test('webgl2');
});
QUnit.test('Issue #313 Mismatch argument lookup - cpu', () => {
test('cpu');
});
})();