(mode)
| 100 | }); |
| 101 | |
| 102 | function testArray1D4(mode) { |
| 103 | const gpu = new GPU({ mode }); |
| 104 | const texture = ( |
| 105 | gpu.createKernel(function() { return [this.thread.x, this.thread.x + 1, this.thread.x + 2, this.thread.x + 3]; }) |
| 106 | .setOutput([10]) |
| 107 | .setPipeline(true) |
| 108 | .setPrecision('single') |
| 109 | )(); |
| 110 | const expected = texture.toArray(); |
| 111 | const kernel = gpu.createKernel(function() { |
| 112 | return this.constants.value[this.thread.x]; |
| 113 | }) |
| 114 | .setConstants({ |
| 115 | value: texture |
| 116 | }) |
| 117 | .setConstantTypes({ |
| 118 | value: 'Array1D(2)' |
| 119 | }) |
| 120 | .setOutput([10]) |
| 121 | .setPipeline(false) |
| 122 | .setPrecision('single'); |
| 123 | |
| 124 | assert.notEqual(texture.constructor, Array); |
| 125 | assert.equal(expected.constructor, Array); |
| 126 | assert.deepEqual(kernel(), expected); |
| 127 | gpu.destroy(); |
| 128 | } |
| 129 | |
| 130 | (GPU.isSinglePrecisionSupported ? test : skip)('Array1D(4) (GPU only) auto', () => { |
| 131 | testArray1D4(); |
no test coverage detected
searching dependent graphs…