(mode)
| 4 | |
| 5 | describe('features: constants canvas'); |
| 6 | function 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); |
no test coverage detected
searching dependent graphs…