forked from fingerecho/gpu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path159-3d.js
More file actions
52 lines (44 loc) · 1.09 KB
/
Copy path159-3d.js
File metadata and controls
52 lines (44 loc) · 1.09 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
49
50
51
52
(function() {
function threeD(mode) {
var gpu = new GPU({ mode: mode });
const kernel = gpu.createKernel(function(grid) {
return grid[this.thread.y][this.thread.x];
})
.setOutput([5, 5]);
//This would cause the above to fail
gpu.createKernel(function() { return 0; })
.setOutput([5, 5, 5])
.build();
var result = kernel([
[0,1,2,3,4],
[1,2,3,4,5],
[2,3,4,5,6],
[3,4,5,6,7],
[4,5,6,7,8]
]);
QUnit.assert.equal(result.length, 5);
QUnit.assert.deepValueEqual(result, [
[0,1,2,3,4],
[1,2,3,4,5],
[2,3,4,5,6],
[3,4,5,6,7],
[4,5,6,7,8]
]);
gpu.destroy();
}
QUnit.test('Issue #159 - for vars (cpu)', function() {
threeD('cpu');
});
QUnit.test('Issue #159 - for vars (auto)', function() {
threeD(null);
});
QUnit.test('Issue #159 - for vars (gpu)', function() {
threeD('gpu');
});
QUnit.test('Issue #159 - for vars (webgl)', function() {
threeD('webgl');
});
QUnit.test('Issue #159 - for vars (webgl2)', function() {
threeD('webgl2');
});
})();