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
35 lines
887 B
JavaScript
35 lines
887 B
JavaScript
(function() {
|
|
function input(mode) {
|
|
const gpu = new GPU({ mode: mode });
|
|
const input = GPU.input;
|
|
const kernel = gpu.createKernel(function(a, b) {
|
|
return a[this.thread.y][this.thread.x] + b[this.thread.y][this.thread.x];
|
|
})
|
|
.setOutput([9]);
|
|
|
|
const a = new Float32Array(9);
|
|
a.set([1,2,3,4,5,6,7,8,9]);
|
|
|
|
const b = new Float32Array(9);
|
|
b.set([1,2,3,4,5,6,7,8,9]);
|
|
|
|
const result = kernel(input(a, [3, 3]), input(b, [3, 3]));
|
|
QUnit.assert.deepEqual(QUnit.extend([], result), [2,4,6,8,10,12,14,16,18]);
|
|
}
|
|
|
|
QUnit.test( "input (WebGL Only) (auto)", function() {
|
|
input();
|
|
});
|
|
|
|
QUnit.test( "input (WebGL Only) (gpu)", function() {
|
|
input('gpu');
|
|
});
|
|
|
|
QUnit.test( "input (WebGL Only) (webgl)", function() {
|
|
input('webgl');
|
|
});
|
|
|
|
QUnit.test( "input (WebGL Only) (webgl2)", function() {
|
|
input('webgl2');
|
|
});
|
|
})(); |