MCPcopy Index your code
hub / github.com/gpujs/gpu.js / threeD

Function threeD

test/issues/159-3d.js:7–36  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

5(function() {
6 const { GPU } = require('../../src');
7 function threeD(mode) {
8 const gpu = new GPU({ mode });
9
10 const kernel = gpu.createKernel(function(grid) {
11 return grid[this.thread.y][this.thread.x];
12 })
13 .setOutput([5, 5]);
14
15 //This would cause the above to fail
16 gpu.createKernel(function() { return 0; })
17 .setOutput([5, 5, 5])
18 .build();
19
20 const result = kernel([
21 [0,1,2,3,4],
22 [1,2,3,4,5],
23 [2,3,4,5,6],
24 [3,4,5,6,7],
25 [4,5,6,7,8]
26 ]);
27 assert.equal(result.length, 5);
28 assert.deepEqual(result.map(function(v) { return Array.from(v); }), [
29 [0,1,2,3,4],
30 [1,2,3,4,5],
31 [2,3,4,5,6],
32 [3,4,5,6,7],
33 [4,5,6,7,8]
34 ]);
35 gpu.destroy();
36 }
37
38 test('Issue #159 - for vars auto', () => {
39 threeD(null);

Callers 1

159-3d.jsFile · 0.85

Calls 5

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
setOutputMethod · 0.45
buildMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…