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

Function wrongCanvasSizeUnoptimized

test/issues/279-wrong-canvas-size.js:53–75  ·  view source on GitHub ↗
(mode)

Source from the content-addressed store, hash-verified

51
52
53function wrongCanvasSizeUnoptimized(mode) {
54 const gpu = new GPU({ mode });
55
56 const initMatrix = gpu.createKernel(function(value) {
57 return value;
58 })
59 .setOptimizeFloatMemory(false)
60 .setOutput([WIDTH, HEIGHT]);
61
62 const render = gpu.createKernel(function(matrix) {
63 const i = matrix[this.thread.y][this.thread.x];
64 this.color(i, i, i, 1);
65 })
66 .setOutput([WIDTH, HEIGHT])
67 .setGraphical(true);
68
69 const matrix = initMatrix(0.5);
70 render(matrix);
71 const canvas = render.canvas;
72 assert.equal(canvas.width, WIDTH);
73 assert.equal(canvas.height, HEIGHT);
74 gpu.destroy();
75}
76
77(GPU.isCanvasSupported ? test : skip)('Issue #279 wrong canvas size unoptimized - cpu', () => {
78 wrongCanvasSizeUnoptimized('cpu');

Callers 1

Calls 6

createKernelMethod · 0.95
destroyMethod · 0.95
setGraphicalMethod · 0.80
colorMethod · 0.65
setOutputMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…