mirror of
https://github.com/gpujs/gpu.js.git
synced 2025-12-08 20:35:56 +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
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
(function() {
|
|
function floatOutputKernel(output, mode) {
|
|
var gpu = new GPU({ mode: mode });
|
|
|
|
return gpu.createKernel(function(lst) {
|
|
return lst[this.thread.x];
|
|
})
|
|
.setFloatOutput(true)
|
|
.setOutput(output);
|
|
}
|
|
|
|
QUnit.test( "floatOutput (GPU only) (auto)", function() {
|
|
var lst = [1, 2, 3, 4, 5, 6, 7];
|
|
var result = floatOutputKernel([lst.length], null)(lst);
|
|
QUnit.assert.deepEqual(QUnit.extend([], result), lst);
|
|
});
|
|
|
|
QUnit.test( "floatOutput (GPU only) (gpu)", function() {
|
|
var lst = [1, 2, 3, 4, 5, 6, 7];
|
|
var result = floatOutputKernel([lst.length], 'gpu')(lst);
|
|
QUnit.assert.deepEqual(QUnit.extend([], result), lst);
|
|
});
|
|
|
|
QUnit.test( "floatOutput (GPU only) (webgl)", function() {
|
|
var lst = [1, 2, 3, 4, 5, 6, 7];
|
|
var result = floatOutputKernel([lst.length], 'webgl')(lst);
|
|
QUnit.assert.deepEqual(QUnit.extend([], result), lst);
|
|
});
|
|
|
|
QUnit.test( "floatOutput (GPU only) (webgl2)", function() {
|
|
var lst = [1, 2, 3, 4, 5, 6, 7];
|
|
var result = floatOutputKernel([lst.length], 'webgl2')(lst);
|
|
QUnit.assert.deepEqual(QUnit.extend([], result), lst);
|
|
});
|
|
})(); |