(mode)
| 92 | }); |
| 93 | |
| 94 | function testOnly4PixelsAreShownRGBDynamicOutput(mode) { |
| 95 | const gpu = new GPU({ mode }); |
| 96 | const render = gpu.createKernel( |
| 97 | function() { |
| 98 | this.color(1, 1, 1); |
| 99 | }, |
| 100 | { |
| 101 | output: [20, 20], |
| 102 | graphical: true, |
| 103 | dynamicOutput: true, |
| 104 | } |
| 105 | ); |
| 106 | |
| 107 | render(); |
| 108 | |
| 109 | const pixels = render.getPixels(); |
| 110 | assert.equal(pixels.length, 20 * 20 * 4); |
| 111 | assert.equal(pixels.filter(v => v === 255).length, 20 * 20 * 4); |
| 112 | |
| 113 | render.setOutput([10, 10]); |
| 114 | render(); |
| 115 | |
| 116 | const pixels2 = render.getPixels(); |
| 117 | assert.equal(pixels2.length, 10 * 10 * 4); |
| 118 | assert.equal(pixels2.filter(v => v === 255).length, 10 * 10 * 4); |
| 119 | gpu.destroy(); |
| 120 | } |
| 121 | |
| 122 | test('rgb dynamic output auto', () => { |
| 123 | testOnly4PixelsAreShownRGBDynamicOutput(); |
no test coverage detected
searching dependent graphs…