mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-25 16:08:02 +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
51 lines
1.1 KiB
JavaScript
51 lines
1.1 KiB
JavaScript
(function() {
|
|
function threeD(mode) {
|
|
var gpu = new GPU({ mode: mode });
|
|
|
|
const kernel = gpu.createKernel(function(grid) {
|
|
return grid[this.thread.y][this.thread.x];
|
|
})
|
|
.setOutput([5, 5]);
|
|
|
|
//This would cause the above to fail
|
|
gpu.createKernel(function() { return 0; })
|
|
.setOutput([5, 5, 5])
|
|
.build();
|
|
|
|
var result = kernel([
|
|
[0,1,2,3,4],
|
|
[1,2,3,4,5],
|
|
[2,3,4,5,6],
|
|
[3,4,5,6,7],
|
|
[4,5,6,7,8]
|
|
]);
|
|
QUnit.assert.equal(result.length, 5);
|
|
QUnit.assert.deepEqual(result, [
|
|
[0,1,2,3,4],
|
|
[1,2,3,4,5],
|
|
[2,3,4,5,6],
|
|
[3,4,5,6,7],
|
|
[4,5,6,7,8]
|
|
]);
|
|
}
|
|
|
|
QUnit.test('Issue #159 - for vars (cpu)', function() {
|
|
threeD('cpu');
|
|
});
|
|
|
|
QUnit.test('Issue #159 - for vars (auto)', function() {
|
|
threeD(null);
|
|
});
|
|
|
|
QUnit.test('Issue #159 - for vars (gpu)', function() {
|
|
threeD('gpu');
|
|
});
|
|
|
|
QUnit.test('Issue #159 - for vars (webgl)', function() {
|
|
threeD('webgl');
|
|
});
|
|
|
|
QUnit.test('Issue #159 - for vars (webgl2)', function() {
|
|
threeD('webgl2');
|
|
});
|
|
})(); |