(mode)
| 4 | describe('features: dynamic output'); |
| 5 | |
| 6 | function dynamicOutput1DGrows(mode) { |
| 7 | const gpu = new GPU({ mode }); |
| 8 | const kernel = gpu.createKernel(function() { |
| 9 | return this.output.x + this.thread.x; |
| 10 | }, { dynamicOutput: true }); |
| 11 | |
| 12 | kernel.setOutput([5]); |
| 13 | let result = kernel(); |
| 14 | assert.equal(result.length, 5); |
| 15 | assert.deepEqual(Array.from(result), [5,6,7,8,9]); |
| 16 | assert.deepEqual(Array.from(kernel.output), [5]); |
| 17 | |
| 18 | kernel.setOutput([10]); |
| 19 | result = kernel(); |
| 20 | assert.equal(result.length, 10); |
| 21 | assert.deepEqual(Array.from(result), [10,11,12,13,14,15,16,17,18,19]); |
| 22 | assert.deepEqual(Array.from(kernel.output), [10]); |
| 23 | |
| 24 | gpu.destroy(); |
| 25 | } |
| 26 | |
| 27 | test('dynamic output 1d grows auto', () => { |
| 28 | dynamicOutput1DGrows(); |
no test coverage detected
searching dependent graphs…