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

Function testSingleArray1D3

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

Source from the content-addressed store, hash-verified

403});
404
405function testSingleArray1D3(mode) {
406 const gpu = new GPU({ mode });
407 const kernel = gpu.createKernel(function(v) {
408 return v[this.thread.x];
409 }, {
410 argumentTypes: { v: 'Array1D(3)' },
411 dynamicArguments: true,
412 dynamicOutput: true
413 });
414 const expected1 = [
415 new Float32Array([1,2,3]),
416 new Float32Array([4,5,6]),
417 ];
418 kernel.setOutput([expected1.length]);
419 assert.deepEqual(kernel(expected1), expected1);
420 const expected2 = [
421 new Float32Array([1,2,3]),
422 new Float32Array([4,5,6]),
423 new Float32Array([7,8,9]),
424 new Float32Array([10,11,12]),
425 ];
426 kernel.setOutput([expected2.length]);
427 assert.deepEqual(kernel(expected2), expected2);
428 gpu.destroy();
429}
430
431test('Single Array1D3 auto', () => {
432 testSingleArray1D3();

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…