(mode)
| 649 | }); |
| 650 | |
| 651 | function dynamicOutput3DKernelMapGrows(mode) { |
| 652 | const gpu = new GPU({ mode }); |
| 653 | const kernel = gpu.createKernelMap({ |
| 654 | result1: function map(v) { |
| 655 | return v; |
| 656 | } |
| 657 | }, function() { |
| 658 | return map(this.output.x + this.output.y + this.thread.z + this.thread.x + this.thread.y + this.thread.z); |
| 659 | }, { dynamicOutput: true }); |
| 660 | |
| 661 | kernel.setOutput([2,2,2]); |
| 662 | let result = kernel(); |
| 663 | assert.equal(result.result.length, 2); |
| 664 | assert.equal(result.result1.length, 2); |
| 665 | assert.deepEqual(result.result.map(matrix => matrix.map(row => Array.from(row))), [[[4,5],[5,6]],[[6,7],[7,8]]]); |
| 666 | assert.deepEqual(result.result1.map(matrix => matrix.map(row => Array.from(row))), [[[4,5],[5,6]],[[6,7],[7,8]]]); |
| 667 | assert.deepEqual(Array.from(kernel.output), [2,2,2]); |
| 668 | |
| 669 | kernel.setOutput([3,3,3]); |
| 670 | result = kernel(); |
| 671 | assert.equal(result.result.length, 3); |
| 672 | assert.equal(result.result1.length, 3); |
| 673 | assert.deepEqual(result.result.map(matrix => matrix.map(row => Array.from(row))), [ |
| 674 | [ |
| 675 | [6,7,8], |
| 676 | [7,8,9], |
| 677 | [8,9,10] |
| 678 | ], |
| 679 | [ |
| 680 | [8,9,10], |
| 681 | [9,10,11], |
| 682 | [10,11,12] |
| 683 | ], |
| 684 | [ |
| 685 | [10,11,12], |
| 686 | [11,12,13], |
| 687 | [12,13,14] |
| 688 | ] |
| 689 | ]); |
| 690 | assert.deepEqual(result.result1.map(matrix => matrix.map(row => Array.from(row))), [ |
| 691 | [ |
| 692 | [6,7,8], |
| 693 | [7,8,9], |
| 694 | [8,9,10] |
| 695 | ], |
| 696 | [ |
| 697 | [8,9,10], |
| 698 | [9,10,11], |
| 699 | [10,11,12] |
| 700 | ], |
| 701 | [ |
| 702 | [10,11,12], |
| 703 | [11,12,13], |
| 704 | [12,13,14] |
| 705 | ] |
| 706 | ]); |
| 707 | assert.deepEqual(Array.from(kernel.output), [3,3,3]); |
| 708 |
no test coverage detected
searching dependent graphs…