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

Function dynamicOutput2DGraphicalShrinks

test/features/dynamic-output.js:466–502  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

464
465
466function 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
504test('dynamic output 2d graphical shrinks auto', () => {
505 dynamicOutput2DGraphicalShrinks();

Callers 1

dynamic-output.jsFile · 0.85

Calls 6

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

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…