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

Function testArray1D4

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

Source from the content-addressed store, hash-verified

100});
101
102function testArray1D4(mode) {
103 const gpu = new GPU({ mode });
104 const texture = (
105 gpu.createKernel(function() { return [this.thread.x, this.thread.x + 1, this.thread.x + 2, this.thread.x + 3]; })
106 .setOutput([10])
107 .setPipeline(true)
108 .setPrecision('single')
109 )();
110 const expected = texture.toArray();
111 const kernel = gpu.createKernel(function() {
112 return this.constants.value[this.thread.x];
113 })
114 .setConstants({
115 value: texture
116 })
117 .setConstantTypes({
118 value: 'Array1D(2)'
119 })
120 .setOutput([10])
121 .setPipeline(false)
122 .setPrecision('single');
123
124 assert.notEqual(texture.constructor, Array);
125 assert.equal(expected.constructor, Array);
126 assert.deepEqual(kernel(), expected);
127 gpu.destroy();
128}
129
130(GPU.isSinglePrecisionSupported ? test : skip)('Array1D(4) (GPU only) auto', () => {
131 testArray1D4();

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…