forked from gpujs/gpu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction-return.js
More file actions
40 lines (32 loc) · 850 Bytes
/
function-return.js
File metadata and controls
40 lines (32 loc) · 850 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const { assert, skip, test, module: describe } = require('qunit');
const { GPU } = require('../../src');
describe('function return');
function functionReturn( mode ) {
const gpu = new GPU({ mode });
const f = gpu.createKernel(function() {
return 42.0;
}, {
output : [1]
});
assert.ok( f !== null, "function generated test");
assert.equal(f()[0], 42.0, "basic return function test");
gpu.destroy();
}
test("auto", () => {
functionReturn(null);
});
test("gpu", () => {
functionReturn("gpu");
});
(GPU.isWebGLSupported ? test : skip)("webgl", () => {
functionReturn("webgl");
});
(GPU.isWebGL2Supported ? test : skip)("webgl2", () => {
functionReturn("webgl2");
});
(GPU.isHeadlessGLSupported ? test : skip)("headlessgl", () => {
functionReturn("headlessgl");
});
test("cpu", () => {
functionReturn("cpu");
});