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

Function testSingleArray3D2

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

Source from the content-addressed store, hash-verified

689});
690
691function testSingleArray3D2(mode) {
692 const gpu = new GPU({ mode });
693 const kernel = gpu.createKernel(function(v) {
694 return v[this.thread.z][this.thread.y][this.thread.x];
695 }, {
696 argumentTypes: { v: 'Array3D(2)' },
697 dynamicArguments: true,
698 dynamicOutput: true
699 });
700 const expected1 = [
701 [
702 [
703 new Float32Array([1,2]),
704 new Float32Array([3,4]),
705 ],[
706 new Float32Array([5,6]),
707 new Float32Array([7,8]),
708 ]
709 ],[
710 [
711 new Float32Array([9,10]),
712 new Float32Array([11,12]),
713 ],[
714 new Float32Array([13,14]),
715 new Float32Array([15,16]),
716 ]
717 ]
718 ];
719 kernel.setOutput([expected1[0][0].length, expected1[0].length, expected1.length]);
720 assert.deepEqual(kernel(expected1), expected1);
721 const expected2 = [
722 [
723 [
724 new Float32Array([1,2]),
725 new Float32Array([3,4]),
726 new Float32Array([5,6]),
727 new Float32Array([7,8]),
728 ],[
729 new Float32Array([9,10]),
730 new Float32Array([11,12]),
731 new Float32Array([13,14]),
732 new Float32Array([15,16]),
733 ]
734 ],[
735 [
736 new Float32Array([17,18]),
737 new Float32Array([19,20]),
738 new Float32Array([21,22]),
739 new Float32Array([23,24]),
740 ],[
741 new Float32Array([25,26]),
742 new Float32Array([27,28]),
743 new Float32Array([29,30]),
744 new Float32Array([31,32]),
745 ]
746 ]
747 ];
748 kernel.setOutput([expected2[0][0].length, expected2[0].length, expected2.length]);

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…