(mode)
| 4 | describe('internal: constants texture switching'); |
| 5 | |
| 6 | function testArray1D2(mode) { |
| 7 | const gpu = new GPU({ mode }); |
| 8 | const texture = ( |
| 9 | gpu.createKernel(function() { return [this.thread.x, this.thread.x + 1]; }) |
| 10 | .setOutput([10]) |
| 11 | .setPipeline(true) |
| 12 | .setPrecision('single') |
| 13 | )(); |
| 14 | const expected = texture.toArray(); |
| 15 | const kernel = gpu.createKernel(function() { |
| 16 | return this.constants.value[this.thread.x]; |
| 17 | }) |
| 18 | .setConstants({ |
| 19 | value: texture |
| 20 | }) |
| 21 | .setConstantTypes({ |
| 22 | value: 'Array1D(2)' |
| 23 | }) |
| 24 | .setOutput([10]) |
| 25 | .setPipeline(false) |
| 26 | .setPrecision('single'); |
| 27 | |
| 28 | assert.notEqual(texture.constructor, Array); |
| 29 | assert.equal(expected.constructor, Array); |
| 30 | assert.deepEqual(kernel(), expected); |
| 31 | gpu.destroy(); |
| 32 | } |
| 33 | |
| 34 | (GPU.isSinglePrecisionSupported ? test : skip)('Array1D(2) (GPU only) auto', () => { |
| 35 | testArray1D2(); |
no test coverage detected
searching dependent graphs…