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

Function canvasConstantTest

test/features/constants-canvas.js:6–23  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

4
5describe('features: constants canvas');
6function canvasConstantTest(mode) {
7 const gpu = new GPU({ mode });
8 const canvas = greenCanvas(mode, 1, 1);
9 const kernel = gpu.createKernel(
10 function() {
11 const pixel = this.constants.canvas[this.thread.y][this.thread.x];
12 return pixel.g;
13 },
14 {
15 constants: { canvas },
16 output: [1, 1],
17 }
18 );
19 const result = kernel();
20 const test = result[0][0] > 0;
21 assert.ok(test, 'image constant passed test');
22 gpu.destroy();
23}
24
25(typeof HTMLCanvasElement !== 'undefined' ? test : skip)('auto', () => {
26 canvasConstantTest(null);

Callers 1

Calls 4

createKernelMethod · 0.95
destroyMethod · 0.95
greenCanvasFunction · 0.85
kernelFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…