(mode)
| 82 | }); |
| 83 | |
| 84 | function inputYX(mode) { |
| 85 | const gpu = new GPU({ mode }); |
| 86 | const kernel = gpu.createKernel(function(a) { |
| 87 | return a[this.thread.y][this.thread.x]; |
| 88 | }) |
| 89 | .setOutput([3, 3]); |
| 90 | |
| 91 | const a = new Float32Array(9); |
| 92 | a.set([1,2,3,4,5,6,7,8,9]); |
| 93 | |
| 94 | const result = kernel(input(a, [3, 3])); |
| 95 | assert.deepEqual(result.map(function(v) { return Array.from(v); }), [[1,2,3],[4,5,6],[7,8,9]]); |
| 96 | gpu.destroy(); |
| 97 | } |
| 98 | |
| 99 | test("inputYX auto", () => { |
| 100 | inputYX(); |