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

Function arrayTexture1

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

Source from the content-addressed store, hash-verified

269});
270
271function arrayTexture1(mode) {
272 const gpu = new GPU({ mode });
273 function addOne(functionValue) {
274 return functionValue[this.thread.x] + 1;
275 }
276 gpu.addFunction(addOne);
277 const texture1 = gpu.createKernel(function() {
278 return 1;
279 }, {
280 output: [1],
281 precision: 'single',
282 pipeline: true,
283 })();
284 if (mode !== 'cpu') {
285 assert.equal(texture1.type, 'ArrayTexture(1)');
286 }
287
288 const kernel = gpu.createKernel(function(kernelValue) {
289 return addOne(kernelValue);
290 }, { output: [1] });
291 const result = kernel(texture1);
292 assert.equal(result[0], 2);
293 gpu.destroy();
294}
295
296(GPU.isSinglePrecisionSupported ? test : skip)('ArrayTexture(1) auto', ()=> {
297 arrayTexture1();

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…