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

Function testSingleArray2D4

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

Source from the content-addressed store, hash-verified

627});
628
629function testSingleArray2D4(mode) {
630 const gpu = new GPU({ mode });
631 const kernel = gpu.createKernel(function(v) {
632 return v[this.thread.y][this.thread.x];
633 }, {
634 argumentTypes: { v: 'Array2D(4)' },
635 dynamicArguments: true,
636 dynamicOutput: true
637 });
638 const expected1 = [
639 [
640 new Float32Array([1,2,3,4]),
641 new Float32Array([5,6,7,8]),
642 ],[
643 new Float32Array([9,10,11,12]),
644 new Float32Array([13,14,15,16]),
645 ]
646 ];
647 kernel.setOutput([expected1[0].length, expected1.length]);
648 assert.deepEqual(kernel(expected1), expected1);
649 const expected2 = [
650 [
651 new Float32Array([1,2,3,4]),
652 new Float32Array([5,6,7,8]),
653 new Float32Array([9,10,11,12]),
654 new Float32Array([13,14,15,16]),
655 ],[
656 new Float32Array([17,18,19,20]),
657 new Float32Array([21,22,23,24]),
658 new Float32Array([25,26,27,28]),
659 new Float32Array([29,30,31,32]),
660 ]
661 ];
662 kernel.setOutput([expected2[0].length, expected2.length]);
663 assert.deepEqual(kernel(expected2), expected2);
664 gpu.destroy();
665}
666
667test('Single Array2D4 auto', () => {
668 testSingleArray2D4();

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…