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

Function testArray2D3

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

Source from the content-addressed store, hash-verified

196});
197
198function testArray2D3(mode) {
199 const gpu = new GPU({ mode });
200 const texture = (
201 gpu.createKernel(function() { return [this.thread.x, this.thread.y, this.thread.x * this.thread.y]; })
202 .setOutput([10, 10])
203 .setPipeline(true)
204 .setPrecision('single')
205 )();
206 const expected = texture.toArray();
207 const kernel = gpu.createKernel(function() {
208 return this.constants.value[this.thread.y][this.thread.x];
209 })
210 .setConstants({
211 value: texture
212 })
213 .setConstantTypes({
214 value: 'Array1D(2)'
215 })
216 .setOutput([10, 10])
217 .setPipeline(false)
218 .setPrecision('single');
219
220 assert.notEqual(texture.constructor, Array);
221 assert.equal(expected.constructor, Array);
222 assert.deepEqual(kernel(), expected);
223 gpu.destroy();
224}
225
226(GPU.isSinglePrecisionSupported ? test : skip)('Array2D(3) (GPU only) auto', () => {
227 testArray2D3();

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…