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

Function arrayTexture2

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

Source from the content-addressed store, hash-verified

313});
314
315function arrayTexture2(mode) {
316 const gpu = new GPU({ mode });
317 function addOne(functionValue) {
318 const declaredValue = functionValue[this.thread.x];
319 return declaredValue[0] + 1 + declaredValue[1] + 1;
320 }
321 gpu.addFunction(addOne);
322 const texture1 = gpu.createKernel(function() {
323 return [1,2];
324 }, {
325 output: [1],
326 precision: 'single',
327 pipeline: true,
328 })();
329 if (mode !== 'cpu') {
330 assert.equal(texture1.type, 'ArrayTexture(2)');
331 }
332
333 const kernel = gpu.createKernel(function(kernelValue) {
334 return addOne(kernelValue);
335 }, { output: [1] });
336 const result = kernel(texture1);
337 assert.equal(result[0], 5);
338 gpu.destroy();
339}
340
341(GPU.isSinglePrecisionSupported ? test : skip)('ArrayTexture(2) auto', ()=> {
342 arrayTexture2();

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…