(mode)
| 565 | }); |
| 566 | |
| 567 | function testSingleArray2D3(mode) { |
| 568 | const gpu = new GPU({ mode }); |
| 569 | const kernel = gpu.createKernel(function(v) { |
| 570 | return v[this.thread.y][this.thread.x]; |
| 571 | }, { |
| 572 | argumentTypes: { v: 'Array2D(3)' }, |
| 573 | dynamicArguments: true, |
| 574 | dynamicOutput: true |
| 575 | }); |
| 576 | const expected1 = [ |
| 577 | [ |
| 578 | new Float32Array([1,2,3]), |
| 579 | new Float32Array([4,5,6]), |
| 580 | ],[ |
| 581 | new Float32Array([7,8,9]), |
| 582 | new Float32Array([10,11,12]), |
| 583 | ] |
| 584 | ]; |
| 585 | kernel.setOutput([expected1[0].length, expected1.length]); |
| 586 | assert.deepEqual(kernel(expected1), expected1); |
| 587 | const expected2 = [ |
| 588 | [ |
| 589 | new Float32Array([1,2,3]), |
| 590 | new Float32Array([4,5,6]), |
| 591 | new Float32Array([7,8,9]), |
| 592 | new Float32Array([10,11,12]), |
| 593 | ],[ |
| 594 | new Float32Array([13,14,15]), |
| 595 | new Float32Array([16,17,18]), |
| 596 | new Float32Array([19,20,21]), |
| 597 | new Float32Array([22,23,24]), |
| 598 | ] |
| 599 | ]; |
| 600 | kernel.setOutput([expected2[0].length, expected2.length]); |
| 601 | assert.deepEqual(kernel(expected2), expected2); |
| 602 | gpu.destroy(); |
| 603 | } |
| 604 | |
| 605 | test('Single Array2D3 auto', () => { |
| 606 | testSingleArray2D3(); |
no test coverage detected
searching dependent graphs…