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

Function loaded

test/features/dynamic-arguments.js:17–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

15 };
16
17 function loaded() {
18 const gpu = new GPU({ mode });
19 const kernel = gpu.createKernel(function(image) {
20 const pixel = image[this.thread.y][this.thread.x];
21 return (pixel[0] + pixel[1] + pixel[2]) / 3;
22 })
23 .setDynamicArguments(true)
24 .setDynamicOutput(true)
25 .setOutput([276, 183]);
26
27 const pixels1 = kernel(image1);
28 kernel.setOutput([138, 91]);
29 const pixels2 = kernel(image2);
30
31 assert.ok(pixels1[0][0] > .43);
32 assert.ok(pixels1[0][0] < .45);
33 assert.equal(pixels1.length, image1.height);
34 assert.equal(pixels1[0].length, image1.width);
35 assert.ok(pixels2[0][0] > .82);
36 assert.ok(pixels2[0][0] < .83);
37 assert.equal(pixels2.length, image2.height);
38 assert.equal(pixels2[0].length, image2.width);
39
40 gpu.destroy();
41 done();
42 }
43}
44
45(typeof Image !== 'undefined' ? test : skip)('HTML Image auto', t => {

Callers 1

testHTMLImageFunction · 0.85

Calls 6

createKernelMethod · 0.95
destroyMethod · 0.95
kernelFunction · 0.85
setDynamicOutputMethod · 0.80
setDynamicArgumentsMethod · 0.80
setOutputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…