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

Function arrayTexture4

test/internal/deep-types.js:407–434  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

405});
406
407function arrayTexture4(mode) {
408 const gpu = new GPU({ mode });
409 function addOne(functionValue) {
410 const declaredValue = functionValue[this.thread.x];
411 return declaredValue[0] + 1
412 + declaredValue[1] + 1
413 + declaredValue[2] + 1
414 + declaredValue[3] + 1;
415 }
416 gpu.addFunction(addOne);
417 const texture1 = gpu.createKernel(function() {
418 return [1,2,3,4];
419 }, {
420 output: [1],
421 precision: 'single',
422 pipeline: true,
423 })();
424 if (mode !== 'cpu') {
425 assert.equal(texture1.type, 'ArrayTexture(4)');
426 }
427
428 const kernel = gpu.createKernel(function(kernelValue) {
429 return addOne(kernelValue);
430 }, { output: [1] });
431 const result = kernel(texture1);
432 assert.equal(result[0], 14);
433 gpu.destroy();
434}
435
436(GPU.isSinglePrecisionSupported ? test : skip)('ArrayTexture(4) auto', ()=> {
437 arrayTexture4();

Callers 1

deep-types.jsFile · 0.85

Calls 5

addFunctionMethod · 0.95
createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
addOneFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…