forked from fingerecho/gpu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path212-funky-function-support.js
More file actions
48 lines (41 loc) · 1.04 KB
/
212-funky-function-support.js
File metadata and controls
48 lines (41 loc) · 1.04 KB
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
41
42
43
44
45
46
47
48
(function() {
function funky(mode) {
var gpu = new GPU({ mode: mode });
const kernel = gpu.createKernel(`function(v1, v2) {
return (0, _add.add)(v1[this.thread.y][this.thread.x], v2[this.thread.y][this.thread.x]);
}`)
.setFunctions([
function add(value1, value2) {
return value1 + value2;
}
])
.setOutput([2, 2]);
var result = kernel([
[0,1],
[1,2]
], [
[0,1],
[1,2]
]);
QUnit.assert.deepValueEqual(result, [
[0,2],
[2,4]
]);
gpu.destroy();
}
QUnit.test('Issue #212 - funky function support cpu', function() {
funky('cpu');
});
QUnit.test('Issue #212 - funky function support (auto)', function() {
funky('gpu');
});
QUnit.test('Issue #212 - funky function support (gpu)', function() {
funky('gpu');
});
QUnit.test('Issue #212 - funky function support (webgl)', function() {
funky('webgl');
});
QUnit.test('Issue #212 - funky function support (webgl2)', function() {
funky('webgl2');
});
})();