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

Function testSingleArray2D2

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

Source from the content-addressed store, hash-verified

503});
504
505function testSingleArray2D2(mode) {
506 const gpu = new GPU({ mode });
507 const kernel = gpu.createKernel(function(v) {
508 return v[this.thread.y][this.thread.x];
509 }, {
510 argumentTypes: { v: 'Array2D(2)' },
511 dynamicArguments: true,
512 dynamicOutput: true
513 });
514 const expected1 = [
515 [
516 new Float32Array([1,2]),
517 new Float32Array([3,4]),
518 ],[
519 new Float32Array([5,6]),
520 new Float32Array([7,8]),
521 ]
522 ];
523 kernel.setOutput([expected1[0].length, expected1.length]);
524 assert.deepEqual(kernel(expected1), expected1);
525 const expected2 = [
526 [
527 new Float32Array([1,2]),
528 new Float32Array([3,4]),
529 new Float32Array([5,6]),
530 new Float32Array([7,8]),
531 ],[
532 new Float32Array([9,10]),
533 new Float32Array([11,12]),
534 new Float32Array([13,14]),
535 new Float32Array([15,16]),
536 ]
537 ];
538 kernel.setOutput([expected2[0].length, expected2.length]);
539 assert.deepEqual(kernel(expected2), expected2);
540 gpu.destroy();
541}
542
543test('Single Array2D2 auto', () => {
544 testSingleArray2D2();

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…