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

Function testSingleArray1D4

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

Source from the content-addressed store, hash-verified

453});
454
455function testSingleArray1D4(mode) {
456 const gpu = new GPU({ mode });
457 const kernel = gpu.createKernel(function(v) {
458 return v[this.thread.x];
459 }, {
460 argumentTypes: { v: 'Array1D(4)' },
461 dynamicArguments: true,
462 dynamicOutput: true
463 });
464 const expected1 = [
465 new Float32Array([1,2,3,4]),
466 new Float32Array([5,6,7,8]),
467 ];
468 kernel.setOutput([expected1.length]);
469 assert.deepEqual(kernel(expected1), expected1);
470 const expected2 = [
471 new Float32Array([1,2,3,4]),
472 new Float32Array([5,6,7,8]),
473 new Float32Array([9,10,11,12]),
474 new Float32Array([13,14,15,16]),
475 ];
476 kernel.setOutput([expected2.length]);
477 assert.deepEqual(kernel(expected2), expected2);
478 gpu.destroy();
479}
480
481test('Single Array1D4 auto', () => {
482 testSingleArray1D4();

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…