MCPcopy Index your code
hub / github.com/gpujs/gpu.js / testOnly4PixelsAreShownRGBDynamicOutput

Function testOnly4PixelsAreShownRGBDynamicOutput

test/issues/473-4-pixels.js:94–120  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

92});
93
94function 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
122test('rgb dynamic output auto', () => {
123 testOnly4PixelsAreShownRGBDynamicOutput();

Callers 1

473-4-pixels.jsFile · 0.85

Calls 5

createKernelMethod · 0.95
destroyMethod · 0.95
colorMethod · 0.65
getPixelsMethod · 0.45
setOutputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…