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

Function testGraphical

test/features/to-string/precision/unsigned/graphical.js:6–31  ·  view source on GitHub ↗
(mode, context, canvas)

Source from the content-addressed store, hash-verified

4describe('feature: to-string unsigned precision graphical');
5
6function testGraphical(mode, context, canvas) {
7 const gpu = new GPU({ mode });
8 const originalKernel = gpu.createKernel(function() {
9 this.color(1,1,1,1);
10 }, {
11 canvas,
12 context,
13 output: [2,2],
14 precision: 'unsigned',
15 graphical: true,
16 });
17
18 const expected = new Uint8ClampedArray([
19 255, 255, 255, 255,
20 255, 255, 255, 255,
21 255, 255, 255, 255,
22 255, 255, 255, 255,
23 ]);
24 originalKernel();
25 assert.deepEqual(originalKernel.getPixels(), expected);
26 const kernelString = originalKernel.toString();
27 const newKernel = new Function('return ' + kernelString)()({ canvas, context });
28 newKernel();
29 assert.deepEqual(newKernel.getPixels(), expected);
30 gpu.destroy();
31}
32
33(GPU.isWebGLSupported ? test : skip)('webgl', () => {
34 const canvas = document.createElement('canvas');

Callers 1

graphical.jsFile · 0.70

Calls 5

createKernelMethod · 0.95
destroyMethod · 0.95
colorMethod · 0.65
getPixelsMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…