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

Function readWithoutTextureKernels

test/features/read-from-texture.js:6–24  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

4describe('features: read from texture');
5
6function readWithoutTextureKernels(mode) {
7 const gpu = new GPU({ mode });
8
9 function add(m, n) {
10 return m + n;
11 }
12
13 const kernels = gpu.createKernelMap({
14 addResult: add
15 }, function (a, b) {
16 return add(a[this.thread.x], b[this.thread.x]);
17 })
18 .setOutput([5]);
19 const result = kernels([1, 2, 3, 4, 5], [1, 2, 3, 4, 5]);
20 const nonTextureResult = result.addResult;
21 assert.deepEqual(Array.from(result.result), [2, 4, 6, 8, 10]);
22 assert.deepEqual(Array.from(nonTextureResult), [2, 4, 6, 8, 10]);
23 gpu.destroy();
24}
25
26(GPU.isKernelMapSupported ? test : skip)('Read without texture auto', () => {
27 readWithoutTextureKernels();

Callers 1

Calls 4

createKernelMapMethod · 0.95
destroyMethod · 0.95
addFunction · 0.70
setOutputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…