mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-18 16:04:10 +00:00
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
47 lines
1.0 KiB
JavaScript
47 lines
1.0 KiB
JavaScript
(function() {
|
|
function funky(mode) {
|
|
var gpu = new GPU({ mode: mode });
|
|
|
|
const kernel = gpu.createKernel(`function(v1, v2) {
|
|
return (0, _add.add)(v1[this.thread.y][this.thread.x], v2[this.thread.y][this.thread.x]);
|
|
}`)
|
|
.setFunctions([
|
|
function add(value1, value2) {
|
|
return value1 + value2;
|
|
}
|
|
])
|
|
.setOutput([2, 2]);
|
|
|
|
var result = kernel([
|
|
[0,1],
|
|
[1,2]
|
|
], [
|
|
[0,1],
|
|
[1,2]
|
|
]);
|
|
QUnit.assert.deepEqual(result, [
|
|
[0,2],
|
|
[2,4]
|
|
]);
|
|
}
|
|
|
|
QUnit.test('Issue #212 - funky function support cpu', function() {
|
|
funky('cpu');
|
|
});
|
|
|
|
QUnit.test('Issue #212 - funky function support (auto)', function() {
|
|
funky('gpu');
|
|
});
|
|
|
|
QUnit.test('Issue #212 - funky function support (gpu)', function() {
|
|
funky('gpu');
|
|
});
|
|
|
|
QUnit.test('Issue #212 - funky function support (webgl)', function() {
|
|
funky('webgl');
|
|
});
|
|
|
|
QUnit.test('Issue #212 - funky function support (webgl2)', function() {
|
|
funky('webgl2');
|
|
});
|
|
})(); |