(mode)
| 40 | |
| 41 | |
| 42 | function inputXY(mode) { |
| 43 | const gpu = new GPU({ mode }); |
| 44 | const kernel = gpu.createKernel(function(a) { |
| 45 | return a[this.thread.y][this.thread.x]; |
| 46 | }) |
| 47 | .setOutput([9]); |
| 48 | |
| 49 | const a = new Float32Array(9); |
| 50 | a.set([1,2,3,4,5,6,7,8,9]); |
| 51 | |
| 52 | const b = new Float32Array(9); |
| 53 | b.set([1,2,3,4,5,6,7,8,9]); |
| 54 | |
| 55 | const result = kernel(input(a, [3, 3])); |
| 56 | assert.deepEqual(Array.from(result), [1,2,3,4,5,6,7,8,9]); |
| 57 | gpu.destroy(); |
| 58 | } |
| 59 | |
| 60 | test("inputXY auto", () => { |
| 61 | inputXY(); |