(mode)
| 503 | }); |
| 504 | |
| 505 | function testSingleArray2D2(mode) { |
| 506 | const gpu = new GPU({ mode }); |
| 507 | const kernel = gpu.createKernel(function(v) { |
| 508 | return v[this.thread.y][this.thread.x]; |
| 509 | }, { |
| 510 | argumentTypes: { v: 'Array2D(2)' }, |
| 511 | dynamicArguments: true, |
| 512 | dynamicOutput: true |
| 513 | }); |
| 514 | const expected1 = [ |
| 515 | [ |
| 516 | new Float32Array([1,2]), |
| 517 | new Float32Array([3,4]), |
| 518 | ],[ |
| 519 | new Float32Array([5,6]), |
| 520 | new Float32Array([7,8]), |
| 521 | ] |
| 522 | ]; |
| 523 | kernel.setOutput([expected1[0].length, expected1.length]); |
| 524 | assert.deepEqual(kernel(expected1), expected1); |
| 525 | const expected2 = [ |
| 526 | [ |
| 527 | new Float32Array([1,2]), |
| 528 | new Float32Array([3,4]), |
| 529 | new Float32Array([5,6]), |
| 530 | new Float32Array([7,8]), |
| 531 | ],[ |
| 532 | new Float32Array([9,10]), |
| 533 | new Float32Array([11,12]), |
| 534 | new Float32Array([13,14]), |
| 535 | new Float32Array([15,16]), |
| 536 | ] |
| 537 | ]; |
| 538 | kernel.setOutput([expected2[0].length, expected2.length]); |
| 539 | assert.deepEqual(kernel(expected2), expected2); |
| 540 | gpu.destroy(); |
| 541 | } |
| 542 | |
| 543 | test('Single Array2D2 auto', () => { |
| 544 | testSingleArray2D2(); |
no test coverage detected
searching dependent graphs…