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

Function testArray1D2

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

Source from the content-addressed store, hash-verified

4describe('internal: constants texture switching');
5
6function testArray1D2(mode) {
7 const gpu = new GPU({ mode });
8 const texture = (
9 gpu.createKernel(function() { return [this.thread.x, this.thread.x + 1]; })
10 .setOutput([10])
11 .setPipeline(true)
12 .setPrecision('single')
13 )();
14 const expected = texture.toArray();
15 const kernel = gpu.createKernel(function() {
16 return this.constants.value[this.thread.x];
17 })
18 .setConstants({
19 value: texture
20 })
21 .setConstantTypes({
22 value: 'Array1D(2)'
23 })
24 .setOutput([10])
25 .setPipeline(false)
26 .setPrecision('single');
27
28 assert.notEqual(texture.constructor, Array);
29 assert.equal(expected.constructor, Array);
30 assert.deepEqual(kernel(), expected);
31 gpu.destroy();
32}
33
34(GPU.isSinglePrecisionSupported ? test : skip)('Array1D(2) (GPU only) auto', () => {
35 testArray1D2();

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…