| 196 | }); |
| 197 | |
| 198 | function outputGraphicalMatrix(mode, canvas, context) { |
| 199 | const gpu = new GPU({ mode }); |
| 200 | const input = [ |
| 201 | [0.25,.50], |
| 202 | [.75,1], |
| 203 | ]; |
| 204 | const kernel = gpu.createKernel(function(input) { |
| 205 | const color = input[this.thread.y][this.thread.x]; |
| 206 | this.color(color, color, color, color); |
| 207 | }, { |
| 208 | context, |
| 209 | canvas, |
| 210 | output: [2, 2], |
| 211 | graphical: true |
| 212 | }); |
| 213 | const result = kernel(input); |
| 214 | assert.equal(result, undefined); |
| 215 | const pixels = Array.from(kernel.getPixels()); |
| 216 | gpu.destroy(); |
| 217 | return pixels; |
| 218 | } |
| 219 | |
| 220 | (GPU.isWebGLSupported ? test : skip)('graphical output matrix webgl', () => { |
| 221 | const canvas = document.createElement('canvas'); |