forked from fingerecho/gpu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path130-typed-array.js
More file actions
37 lines (31 loc) · 941 Bytes
/
130-typed-array.js
File metadata and controls
37 lines (31 loc) · 941 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
(function() {
function typedArrayTest(mode) {
const gpu = new GPU({ mode });
const kernel = gpu.createKernel(function(changes) {
return changes[this.thread.y][this.thread.x];
})
.setOutput([2, 1]);
const values = [new Float32Array(2)];
values[0][0] = 0;
values[0][1] = 0;
const result = kernel(values);
QUnit.assert.equal(result[0][0], 0);
QUnit.assert.equal(result[0][1], 0);
gpu.destroy();
}
QUnit.test( "Issue #130 - typed array (cpu)", function() {
typedArrayTest('cpu');
});
QUnit.test( "Issue #130 - typed array (auto)", function() {
typedArrayTest(null);
});
QUnit.test( "Issue #130 - typed array (gpu)", function() {
typedArrayTest('gpu');
});
QUnit.test( "Issue #130 - typed array (webgl)", function() {
typedArrayTest('webgl');
});
QUnit.test( "Issue #130 - typed array (webgl2)", function() {
typedArrayTest('webgl2');
});
})();