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

Function testArray3D2

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

Source from the content-addressed store, hash-verified

299});
300
301function testArray3D2(mode) {
302 const gpu = new GPU({ mode });
303 const texture = (
304 gpu.createKernel(function() { return [this.thread.x, this.thread.x * this.thread.y * this.thread.z]; })
305 .setOutput([10, 10, 10])
306 .setPipeline(true)
307 .setPrecision('single')
308 )();
309 const expected = texture.toArray();
310 const kernel = gpu.createKernel(function() {
311 return this.constants.value[this.thread.z][this.thread.y][this.thread.x];
312 })
313 .setConstants({
314 value: texture
315 })
316 .setConstantTypes({
317 value: 'Array1D(2)'
318 })
319 .setOutput([10, 10, 10])
320 .setPipeline(false)
321 .setPrecision('single');
322
323 assert.notEqual(texture.constructor, Array);
324 assert.equal(expected.constructor, Array);
325 assert.deepEqual(kernel(), expected);
326 gpu.destroy();
327}
328
329(GPU.isSinglePrecisionSupported ? test : skip)('Array3D(2) (GPU only) auto', () => {
330 testArray3D2();

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…