(mode)
| 453 | }); |
| 454 | |
| 455 | function testSingleArray1D4(mode) { |
| 456 | const gpu = new GPU({ mode }); |
| 457 | const kernel = gpu.createKernel(function(v) { |
| 458 | return v[this.thread.x]; |
| 459 | }, { |
| 460 | argumentTypes: { v: 'Array1D(4)' }, |
| 461 | dynamicArguments: true, |
| 462 | dynamicOutput: true |
| 463 | }); |
| 464 | const expected1 = [ |
| 465 | new Float32Array([1,2,3,4]), |
| 466 | new Float32Array([5,6,7,8]), |
| 467 | ]; |
| 468 | kernel.setOutput([expected1.length]); |
| 469 | assert.deepEqual(kernel(expected1), expected1); |
| 470 | const expected2 = [ |
| 471 | new Float32Array([1,2,3,4]), |
| 472 | new Float32Array([5,6,7,8]), |
| 473 | new Float32Array([9,10,11,12]), |
| 474 | new Float32Array([13,14,15,16]), |
| 475 | ]; |
| 476 | kernel.setOutput([expected2.length]); |
| 477 | assert.deepEqual(kernel(expected2), expected2); |
| 478 | gpu.destroy(); |
| 479 | } |
| 480 | |
| 481 | test('Single Array1D4 auto', () => { |
| 482 | testSingleArray1D4(); |
no test coverage detected
searching dependent graphs…