MCPcopy Create free account
hub / github.com/gpujs/gpu.js / testArray3D4

Function testArray3D4

test/internal/constants-texture-switching.js:397–430  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

395});
396
397function testArray3D4(mode) {
398 const gpu = new GPU({ mode });
399 const texture = (
400 gpu.createKernel(function() {
401 return [
402 this.thread.x,
403 this.thread.y,
404 this.thread.z,
405 this.thread.x * this.thread.y * this.thread.z
406 ];
407 })
408 .setOutput([10, 10, 10])
409 .setPipeline(true)
410 .setPrecision('single')
411 )();
412 const expected = texture.toArray();
413 const kernel = gpu.createKernel(function() {
414 return this.constants.value[this.thread.z][this.thread.y][this.thread.x];
415 })
416 .setConstants({
417 value: texture
418 })
419 .setConstantTypes({
420 value: 'Array1D(2)'
421 })
422 .setOutput([10, 10, 10])
423 .setPipeline(false)
424 .setPrecision('single');
425
426 assert.notEqual(texture.constructor, Array);
427 assert.equal(expected.constructor, Array);
428 assert.deepEqual(kernel(), expected);
429 gpu.destroy();
430}
431
432(GPU.isSinglePrecisionSupported ? test : skip)('Array3D(4) (GPU only) auto', () => {
433 testArray3D4();

Callers 1

Calls 9

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
setPipelineMethod · 0.80
setConstantTypesMethod · 0.80
setConstantsMethod · 0.80
setPrecisionMethod · 0.45
setOutputMethod · 0.45
toArrayMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…