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

Function testArray2D2

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

Source from the content-addressed store, hash-verified

148});
149
150function testArray2D2(mode) {
151 const gpu = new GPU({ mode });
152 const texture = (
153 gpu.createKernel(function() { return [this.thread.x, this.thread.y]; })
154 .setOutput([10, 10])
155 .setPipeline(true)
156 .setPrecision('single')
157 )();
158 const expected = texture.toArray();
159 const kernel = gpu.createKernel(function() {
160 return this.constants.value[this.thread.y][this.thread.x];
161 })
162 .setConstants({
163 value: texture
164 })
165 .setConstantTypes({
166 value: 'Array1D(2)'
167 })
168 .setOutput([10, 10])
169 .setPipeline(false)
170 .setPrecision('single');
171
172 assert.notEqual(texture.constructor, Array);
173 assert.equal(expected.constructor, Array);
174 assert.deepEqual(kernel(), expected);
175 gpu.destroy();
176}
177
178(GPU.isSinglePrecisionSupported ? test : skip)('Array2D(2) (GPU only) auto', () => {
179 testArray2D2();

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…