Using Tools.CreateScreenshotUsingRenderTarget on certain machines, I found that I was getting a RangeError on TypedArray.set (used inside of Tools.DumpFramebuffer on the line that says: castData.set(data);).
What was happening was that the data generated by
var data = engine.readPixels(0, 0, width, height);
Was a different length than the castData generated by
var imageData = context.createImageData(width, height);
The reason for that seemed to be that context.createImageData at a low level ends up clamping the width and height based on the width and height of the _gl instance, which was always an integer, but the engine.readPixels uses the floating point width and height passed in.
So, for example, if my canvas was 900.5 px by 600.8px, the data array would be slightly larger than the imageData array, and the RangeError would result.
In order for me to fix it, i just had to do a Math.floor on the width/height i pass in to CreateScreenshotUsingRenderTarget, but i thought i would pass these findings along to you guys, and maybe the math.floor should occur inside of the DumpFramebuffer or somewhere within the babylon code to ensure that it works.