(mode)
| 395 | }); |
| 396 | |
| 397 | function testArray3D4(mode) { |
| 398 | const gpu = new GPU({ mode }); |
| 399 | const texture = ( |
| 400 | gpu.createKernel(function() { |
| 401 | return [ |
| 402 | this.thread.x, |
| 403 | this.thread.y, |
| 404 | this.thread.z, |
| 405 | this.thread.x * this.thread.y * this.thread.z |
| 406 | ]; |
| 407 | }) |
| 408 | .setOutput([10, 10, 10]) |
| 409 | .setPipeline(true) |
| 410 | .setPrecision('single') |
| 411 | )(); |
| 412 | const expected = texture.toArray(); |
| 413 | const kernel = gpu.createKernel(function() { |
| 414 | return this.constants.value[this.thread.z][this.thread.y][this.thread.x]; |
| 415 | }) |
| 416 | .setConstants({ |
| 417 | value: texture |
| 418 | }) |
| 419 | .setConstantTypes({ |
| 420 | value: 'Array1D(2)' |
| 421 | }) |
| 422 | .setOutput([10, 10, 10]) |
| 423 | .setPipeline(false) |
| 424 | .setPrecision('single'); |
| 425 | |
| 426 | assert.notEqual(texture.constructor, Array); |
| 427 | assert.equal(expected.constructor, Array); |
| 428 | assert.deepEqual(kernel(), expected); |
| 429 | gpu.destroy(); |
| 430 | } |
| 431 | |
| 432 | (GPU.isSinglePrecisionSupported ? test : skip)('Array3D(4) (GPU only) auto', () => { |
| 433 | testArray3D4(); |
no test coverage detected
searching dependent graphs…