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

Function testSingleArray2D3

test/features/dynamic-arguments.js:567–603  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

565});
566
567function testSingleArray2D3(mode) {
568 const gpu = new GPU({ mode });
569 const kernel = gpu.createKernel(function(v) {
570 return v[this.thread.y][this.thread.x];
571 }, {
572 argumentTypes: { v: 'Array2D(3)' },
573 dynamicArguments: true,
574 dynamicOutput: true
575 });
576 const expected1 = [
577 [
578 new Float32Array([1,2,3]),
579 new Float32Array([4,5,6]),
580 ],[
581 new Float32Array([7,8,9]),
582 new Float32Array([10,11,12]),
583 ]
584 ];
585 kernel.setOutput([expected1[0].length, expected1.length]);
586 assert.deepEqual(kernel(expected1), expected1);
587 const expected2 = [
588 [
589 new Float32Array([1,2,3]),
590 new Float32Array([4,5,6]),
591 new Float32Array([7,8,9]),
592 new Float32Array([10,11,12]),
593 ],[
594 new Float32Array([13,14,15]),
595 new Float32Array([16,17,18]),
596 new Float32Array([19,20,21]),
597 new Float32Array([22,23,24]),
598 ]
599 ];
600 kernel.setOutput([expected2[0].length, expected2.length]);
601 assert.deepEqual(kernel(expected2), expected2);
602 gpu.destroy();
603}
604
605test('Single Array2D3 auto', () => {
606 testSingleArray2D3();

Callers 1

Calls 4

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
setOutputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…