(mode, context, canvas)
| 4 | describe('feature: to-string unsigned precision graphical'); |
| 5 | |
| 6 | function 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'); |
no test coverage detected
searching dependent graphs…