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

Function testSingleArray1D2

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

Source from the content-addressed store, hash-verified

353});
354
355function testSingleArray1D2(mode) {
356 const gpu = new GPU({ mode });
357 const kernel = gpu.createKernel(function(v) {
358 return v[this.thread.x];
359 }, {
360 argumentTypes: { v: 'Array1D(2)' },
361 dynamicArguments: true,
362 dynamicOutput: true
363 });
364 const expected1 = [
365 new Float32Array([1,2]),
366 new Float32Array([3,4]),
367 ];
368 kernel.setOutput([expected1.length]);
369 assert.deepEqual(kernel(expected1), expected1);
370 const expected2 = [
371 new Float32Array([1,2]),
372 new Float32Array([3,4]),
373 new Float32Array([5,6]),
374 new Float32Array([7,8]),
375 ];
376 kernel.setOutput([expected2.length]);
377 assert.deepEqual(kernel(expected2), expected2);
378 gpu.destroy();
379}
380
381test('Single Array1D2 auto', () => {
382 testSingleArray1D2();

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…