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

Function testArray3D3

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

Source from the content-addressed store, hash-verified

347});
348
349function testArray3D3(mode) {
350 const gpu = new GPU({ mode });
351 const texture = (
352 gpu.createKernel(function() { return [this.thread.x, this.thread.y, this.thread.z]; })
353 .setOutput([10, 10, 10])
354 .setPipeline(true)
355 .setPrecision('single')
356 )();
357 const expected = texture.toArray();
358 const kernel = gpu.createKernel(function() {
359 return this.constants.value[this.thread.z][this.thread.y][this.thread.x];
360 })
361 .setConstants({
362 value: texture
363 })
364 .setConstantTypes({
365 value: 'Array1D(2)'
366 })
367 .setOutput([10, 10, 10])
368 .setPipeline(false)
369 .setPrecision('single');
370
371 assert.notEqual(texture.constructor, Array);
372 assert.equal(expected.constructor, Array);
373 assert.deepEqual(kernel(), expected);
374 gpu.destroy();
375}
376
377(GPU.isSinglePrecisionSupported ? test : skip)('Array3D(3) (GPU only) auto', () => {
378 testArray3D3();

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…