| 160 | }); |
| 161 | |
| 162 | function inputYXOffsetPlus1(mode) { |
| 163 | const gpu = new GPU({ mode }); |
| 164 | const kernel = gpu.createKernel(function(a) { |
| 165 | return a[this.thread.x][this.thread.y]; |
| 166 | }) |
| 167 | .setOutput([2, 8]); |
| 168 | |
| 169 | const a = new Float32Array([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16]); |
| 170 | |
| 171 | const result = kernel(input(a, [8, 2])); |
| 172 | assert.deepEqual(result.map(function(v) { return Array.from(v); }), [[1,9],[2,10],[3,11],[4,12],[5,13],[6,14],[7,15],[8,16]]); |
| 173 | gpu.destroy(); |
| 174 | } |
| 175 | |
| 176 | test("inputYXOffsetPlus1 auto", () => { |
| 177 | inputYXOffsetPlus1(); |