(mode)
| 6 | const WIDTH = 600; |
| 7 | const HEIGHT = 400; |
| 8 | function wrongCanvasSizeOptimized(mode) { |
| 9 | const gpu = new GPU({ mode }); |
| 10 | |
| 11 | const initMatrix = gpu.createKernel(function(value) { |
| 12 | return value; |
| 13 | }) |
| 14 | .setOptimizeFloatMemory(true) |
| 15 | .setOutput([WIDTH, HEIGHT]); |
| 16 | |
| 17 | const render = gpu.createKernel(function(matrix) { |
| 18 | const i = matrix[this.thread.y][this.thread.x]; |
| 19 | this.color(i, i, i, 1); |
| 20 | }) |
| 21 | .setOutput([WIDTH, HEIGHT]) |
| 22 | .setGraphical(true); |
| 23 | |
| 24 | const matrix = initMatrix(0.5); |
| 25 | render(matrix); |
| 26 | const canvas = render.canvas; |
| 27 | assert.equal(canvas.width, WIDTH); |
| 28 | assert.equal(canvas.height, HEIGHT); |
| 29 | gpu.destroy(); |
| 30 | } |
| 31 | |
| 32 | (GPU.isCanvasSupported ? test : skip)('Issue #279 wrong canvas size optimized - cpu', () => { |
| 33 | wrongCanvasSizeOptimized('cpu'); |
no test coverage detected
searching dependent graphs…