(mode)
| 464 | |
| 465 | |
| 466 | function dynamicOutput2DGraphicalShrinks(mode) { |
| 467 | const gpu = new GPU({ mode }); |
| 468 | const kernel = gpu.createKernel(function() { |
| 469 | this.color(1,1,1,1); |
| 470 | }, { graphical: true, dynamicOutput: true }); |
| 471 | |
| 472 | kernel.setOutput([3,3]); |
| 473 | kernel(); |
| 474 | let result = kernel.getPixels(); |
| 475 | assert.equal(result.length, 3 * 3 * 4); |
| 476 | assert.deepEqual(Array.from(result), [ |
| 477 | 255, 255, 255, 255, |
| 478 | 255, 255, 255, 255, |
| 479 | 255, 255, 255, 255, |
| 480 | 255, 255, 255, 255, |
| 481 | 255, 255, 255, 255, |
| 482 | 255, 255, 255, 255, |
| 483 | 255, 255, 255, 255, |
| 484 | 255, 255, 255, 255, |
| 485 | 255, 255, 255, 255, |
| 486 | ]); |
| 487 | assert.deepEqual(Array.from(kernel.output), [3,3]); |
| 488 | |
| 489 | kernel.setOutput([2,2]); |
| 490 | kernel(); |
| 491 | result = kernel.getPixels(); |
| 492 | assert.equal(result.length, 2 * 2 * 4); |
| 493 | assert.deepEqual(Array.from(result), [ |
| 494 | 255, 255, 255, 255, |
| 495 | 255, 255, 255, 255, |
| 496 | 255, 255, 255, 255, |
| 497 | 255, 255, 255, 255 |
| 498 | ]); |
| 499 | assert.deepEqual(Array.from(kernel.output), [2,2]); |
| 500 | |
| 501 | gpu.destroy(); |
| 502 | } |
| 503 | |
| 504 | test('dynamic output 2d graphical shrinks auto', () => { |
| 505 | dynamicOutput2DGraphicalShrinks(); |
no test coverage detected
searching dependent graphs…