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

Function testArray2D4

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

Source from the content-addressed store, hash-verified

244});
245
246function testArray2D4(mode) {
247 const gpu = new GPU({ mode });
248 const texture = (
249 gpu.createKernel(function() {
250 return [
251 this.thread.x,
252 this.thread.y,
253 this.thread.x * this.thread.y,
254 this.thread.x / this.thread.y
255 ];
256 })
257 .setOutput([10, 10])
258 .setPipeline(true)
259 .setPrecision('single')
260 )();
261 const expected = texture.toArray();
262 const kernel = gpu.createKernel(function() {
263 return this.constants.value[this.thread.y][this.thread.x];
264 })
265 .setConstants({
266 value: texture
267 })
268 .setConstantTypes({
269 value: 'Array1D(2)'
270 })
271 .setOutput([10, 10])
272 .setPipeline(false)
273 .setPrecision('single');
274
275 assert.notEqual(texture.constructor, Array);
276 assert.equal(expected.constructor, Array);
277 assert.deepEqual(kernel(), expected);
278 gpu.destroy();
279}
280
281(GPU.isSinglePrecisionSupported ? test : skip)('Array2D(4) (GPU only) auto', () => {
282 testArray2D4();

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…