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

Function testSingleArray3D3

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

Source from the content-addressed store, hash-verified

775});
776
777function testSingleArray3D3(mode) {
778 const gpu = new GPU({ mode });
779 const kernel = gpu.createKernel(function(v) {
780 return v[this.thread.z][this.thread.y][this.thread.x];
781 }, {
782 argumentTypes: { v: 'Array3D(3)' },
783 dynamicArguments: true,
784 dynamicOutput: true
785 });
786 const expected1 = [
787 [
788 [
789 new Float32Array([1,2,3]),
790 new Float32Array([4,5,6]),
791 ],[
792 new Float32Array([7,8,9]),
793 new Float32Array([10,11,12]),
794 ]
795 ],[
796 [
797 new Float32Array([13,14,15]),
798 new Float32Array([16,17,18]),
799 ],[
800 new Float32Array([19,20,21]),
801 new Float32Array([22,23,24]),
802 ]
803 ]
804 ];
805 kernel.setOutput([expected1[0][0].length, expected1[0].length, expected1.length]);
806 assert.deepEqual(kernel(expected1), expected1);
807 const expected2 = [
808 [
809 [
810 new Float32Array([1,2,3]),
811 new Float32Array([4,5,6]),
812 new Float32Array([7,8,9]),
813 new Float32Array([10,11,12]),
814 ],[
815 new Float32Array([13,14,15]),
816 new Float32Array([16,17,18]),
817 new Float32Array([19,20,21]),
818 new Float32Array([22,23,24]),
819 ]
820 ],[
821 [
822 new Float32Array([25,26,27]),
823 new Float32Array([28,29,30]),
824 new Float32Array([31,32,33]),
825 new Float32Array([34,35,36]),
826 ],[
827 new Float32Array([37,38,39]),
828 new Float32Array([40,41,42]),
829 new Float32Array([43,44,45]),
830 new Float32Array([46,47,48]),
831 ]
832 ]
833 ];
834 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…