| 121 | }); |
| 122 | |
| 123 | function inputYXOffset(mode) { |
| 124 | const gpu = new GPU({ mode }); |
| 125 | const kernel = gpu.createKernel(function(a) { |
| 126 | return a[this.thread.x][this.thread.y]; |
| 127 | }) |
| 128 | .setOutput([8, 2]); |
| 129 | |
| 130 | const a = new Float32Array(16); |
| 131 | a.set([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); |
| 132 | |
| 133 | const result = kernel(input(a, [2, 8])); |
| 134 | assert.deepEqual(result.map(function(v) { return Array.from(v); }), [[1,3,5,7,9,11,13,15],[2,4,6,8,10,12,14,16]]); |
| 135 | gpu.destroy(); |
| 136 | } |
| 137 | |
| 138 | test("inputYXOffset auto", () => { |
| 139 | inputYXOffset(); |