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

Function testArray1D3

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

Source from the content-addressed store, hash-verified

52});
53
54function testArray1D3(mode) {
55 const gpu = new GPU({ mode });
56 const texture = (
57 gpu.createKernel(function() { return [this.thread.x, this.thread.x + 1, this.thread.x + 2]; })
58 .setOutput([10])
59 .setPipeline(true)
60 .setPrecision('single')
61 )();
62 const expected = texture.toArray();
63 const kernel = gpu.createKernel(function() {
64 return this.constants.value[this.thread.x];
65 })
66 .setConstants({
67 value: texture
68 })
69 .setConstantTypes({
70 value: 'Array1D(2)'
71 })
72 .setOutput([10])
73 .setPipeline(false)
74 .setPrecision('single');
75
76 assert.notEqual(texture.constructor, Array);
77 assert.equal(expected.constructor, Array);
78 assert.deepEqual(kernel(), expected);
79 gpu.destroy();
80}
81
82(GPU.isSinglePrecisionSupported ? test : skip)('Array1D(3) (GPU only) auto', () => {
83 testArray1D3();

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…