mirror of
https://github.com/gpujs/gpu.js.git
synced 2026-01-25 16:08:02 +00:00
reproduced error
This commit is contained in:
parent
1c9eda0642
commit
aa9046476c
18
test/html/issues/207-same-function-reuse.html
Normal file
18
test/html/issues/207-same-function-reuse.html
Normal file
@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>GPU.JS : Funky Function Support</title>
|
||||
<link rel="stylesheet" href="../../../node_modules/qunitjs/qunit/qunit.css">
|
||||
|
||||
<!-- gpu.js scripts -->
|
||||
<script src="../../../bin/gpu.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="qunit"></div>
|
||||
<div id="qunit-fixture"></div>
|
||||
<script src="../../../node_modules/qunitjs/qunit/qunit.js"></script>
|
||||
<script src="../../../node_modules/qunit-assert-close/qunit-assert-close.js"></script>
|
||||
<script src="../../src/issues/207-same-function-reuse.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
1
test/html/test-all.html
vendored
1
test/html/test-all.html
vendored
@ -49,6 +49,7 @@
|
||||
<script src="../src/issues/152-for-vars.js"></script>
|
||||
<script src="../src/issues/159-3d.js"></script>
|
||||
<script src="../src/issues/195-read-from-texture2d.js"></script>
|
||||
<script src="../src/issues/207-same-function-reuse.js"></script>
|
||||
<script src="../src/issues/212-funky-function-support.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
32
test/src/issues/207-same-function-reuse.js
Normal file
32
test/src/issues/207-same-function-reuse.js
Normal file
@ -0,0 +1,32 @@
|
||||
function reuse(mode) {
|
||||
var gpu = new GPU({ mode: mode });
|
||||
|
||||
var f = gpu.createKernel(function(a, b) {
|
||||
function custom_adder(a,b) {
|
||||
return a+b;
|
||||
}
|
||||
function some_fun_1(a,b) {
|
||||
return custom_adder(a,b);
|
||||
}
|
||||
function some_fun_2(a,b) {
|
||||
return custom_adder(a,b);
|
||||
}
|
||||
return some_fun_1(1,2)+some_fun_2(a[this.thread.x], b[this.thread.x]);
|
||||
}, {
|
||||
dimensions : [6]
|
||||
}).setDebug(true).setOutput([6]);
|
||||
|
||||
var a = [1, 2, 3, 5, 6, 7];
|
||||
var b = [4, 5, 6, 1, 2, 3];
|
||||
|
||||
var result = f(a,b);
|
||||
assert.deepEqual(QUnit.extend([], result), [5,7,9,6,8,10]);
|
||||
}
|
||||
|
||||
QUnit.test('Issue #207 - same function reuse CPU', function() {
|
||||
reuse('cpu');
|
||||
});
|
||||
|
||||
QUnit.test('Issue #207 - same function reuse GPU', function() {
|
||||
reuse('gpu');
|
||||
});
|
||||
Loading…
x
Reference in New Issue
Block a user