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

Function dynamicOutput2DGraphicalGrows

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

Source from the content-addressed store, hash-verified

401//TODO:
402
403function dynamicOutput2DGraphicalGrows(mode) {
404 const gpu = new GPU({ mode });
405 const kernel = gpu.createKernel(function() {
406 this.color(1,1,1,1);
407 }, { graphical: true, dynamicOutput: true });
408
409 kernel.setOutput([2,2]);
410 kernel();
411 let result = kernel.getPixels();
412 assert.equal(result.length, 2 * 2 * 4);
413 assert.deepEqual(Array.from(result), [
414 255, 255, 255, 255,
415 255, 255, 255, 255,
416 255, 255, 255, 255,
417 255, 255, 255, 255
418 ]);
419 assert.deepEqual(Array.from(kernel.output), [2,2]);
420
421 kernel.setOutput([3,3]);
422 kernel();
423 result = kernel.getPixels();
424 assert.equal(result.length, 3 * 3 * 4);
425 assert.deepEqual(Array.from(result), [
426 255, 255, 255, 255,
427 255, 255, 255, 255,
428 255, 255, 255, 255,
429 255, 255, 255, 255,
430 255, 255, 255, 255,
431 255, 255, 255, 255,
432 255, 255, 255, 255,
433 255, 255, 255, 255,
434 255, 255, 255, 255,
435 ]);
436 assert.deepEqual(Array.from(kernel.output), [3,3]);
437
438 gpu.destroy();
439}
440
441test('dynamic output 2d graphical grows auto', () => {
442 dynamicOutput2DGraphicalGrows();

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…