forked from gpujs/gpu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path359-addfunction-params-wrong.js
More file actions
39 lines (30 loc) · 992 Bytes
/
359-addfunction-params-wrong.js
File metadata and controls
39 lines (30 loc) · 992 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
const { assert, skip, test, module: describe } = require('qunit');
const { GPU } = require('../../src');
describe('issue #359');
function testAddFunctionKernel(mode) {
const gpu = new GPU({mode});
function clcC(xx) {
return Math.abs(xx);
}
function intermediate(c1) {
return clcC(c1);
}
gpu.addFunction(clcC);
gpu.addFunction(intermediate);
const nestFunctionsKernel = gpu.createKernel(function() {
return intermediate(-1);
}, {
output: [1]
});
assert.equal(nestFunctionsKernel()[0], 1);
gpu.destroy();
}
(GPU.isWebGLSupported ? test : skip)('Issue #359 - addFunction calls addFunction issue webgl', () => {
testAddFunctionKernel('webgl')
});
(GPU.isWebGL2Supported ? test : skip)('Issue #359 - addFunction calls addFunction issue webgl2', () => {
testAddFunctionKernel('webgl2')
});
(GPU.isHeadlessGLSupported ? test : skip)('Issue #359 - addFunction calls addFunction issue headlessgl', () => {
testAddFunctionKernel('headlessgl')
});