forked from fingerecho/gpu.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path313-variable-lookup.js
More file actions
40 lines (36 loc) · 1.08 KB
/
Copy path313-variable-lookup.js
File metadata and controls
40 lines (36 loc) · 1.08 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
(function() {
function test(mode) {
var gpu = new GPU({ mode: mode });
function mult2(scale) {
return 2*scale;
}
var render1 = gpu.createKernel(function(input) {
return (mult2(input) + mult2(input*2) + mult2(input*1)) // RIGHT
})
.setOutput([1])
.setFunctions([mult2]);
var render2 = gpu.createKernel(function(input) {
return (mult2(input) + mult2(input*2) + mult2(input)); // WRONG
})
.setOutput([1])
.setFunctions([mult2]);
QUnit.assert.equal(render1(1)[0], 8, 'render1 equals 8');
QUnit.assert.equal(render2(1)[0], 8, 'render2 equals 8');
gpu.destroy();
}
QUnit.test('Issue #313 Mismatch argument lookup - auto', () => {
test();
});
QUnit.test('Issue #313 Mismatch argument lookup - gpu', () => {
test('gpu');
});
QUnit.test('Issue #313 Mismatch argument lookup - webgl', () => {
test('webgl');
});
QUnit.test('Issue #313 Mismatch argument lookup - webgl2', () => {
test('webgl2');
});
QUnit.test('Issue #313 Mismatch argument lookup - cpu', () => {
test('cpu');
});
})();