(mode, done)
| 26 | } |
| 27 | |
| 28 | function imageArrayTest(mode, done) { |
| 29 | const gpu = new GPU({ |
| 30 | mode |
| 31 | }); |
| 32 | const imageKernel = gpu.createKernel(function(images) { |
| 33 | const pixel = images[this.thread.z][this.thread.y][this.thread.x]; |
| 34 | this.color(pixel[0], pixel[1], pixel[2], pixel[3]); |
| 35 | }, { |
| 36 | graphical: true, |
| 37 | output : [138, 91] |
| 38 | }); |
| 39 | getImages(function(images) { |
| 40 | imageKernel(images); |
| 41 | const pixels = imageKernel.getPixels(); |
| 42 | assert.equal(pixels.length, 50232); |
| 43 | // way too large to test the whole picture, just test the first pixel |
| 44 | assert.equal(pixels[0], 147); |
| 45 | assert.equal(pixels[1], 168); |
| 46 | assert.equal(pixels[2], 251); |
| 47 | assert.equal(pixels[3], 255); |
| 48 | gpu.destroy(); |
| 49 | done(imageKernel); |
| 50 | }); |
| 51 | } |
| 52 | |
| 53 | (typeof Image !== 'undefined' ? test : skip)('image array auto', t => { |
| 54 | imageArrayTest(null, t.async()); |
no test coverage detected
searching dependent graphs…