(mode)
| 244 | }); |
| 245 | |
| 246 | function testArray2D4(mode) { |
| 247 | const gpu = new GPU({ mode }); |
| 248 | const texture = ( |
| 249 | gpu.createKernel(function() { |
| 250 | return [ |
| 251 | this.thread.x, |
| 252 | this.thread.y, |
| 253 | this.thread.x * this.thread.y, |
| 254 | this.thread.x / this.thread.y |
| 255 | ]; |
| 256 | }) |
| 257 | .setOutput([10, 10]) |
| 258 | .setPipeline(true) |
| 259 | .setPrecision('single') |
| 260 | )(); |
| 261 | const expected = texture.toArray(); |
| 262 | const kernel = gpu.createKernel(function() { |
| 263 | return this.constants.value[this.thread.y][this.thread.x]; |
| 264 | }) |
| 265 | .setConstants({ |
| 266 | value: texture |
| 267 | }) |
| 268 | .setConstantTypes({ |
| 269 | value: 'Array1D(2)' |
| 270 | }) |
| 271 | .setOutput([10, 10]) |
| 272 | .setPipeline(false) |
| 273 | .setPrecision('single'); |
| 274 | |
| 275 | assert.notEqual(texture.constructor, Array); |
| 276 | assert.equal(expected.constructor, Array); |
| 277 | assert.deepEqual(kernel(), expected); |
| 278 | gpu.destroy(); |
| 279 | } |
| 280 | |
| 281 | (GPU.isSinglePrecisionSupported ? test : skip)('Array2D(4) (GPU only) auto', () => { |
| 282 | testArray2D4(); |
no test coverage detected
searching dependent graphs…