bkaradzic/bgfx — pull request #187 by SmilyOrg (2014-11-20 23:57:59+00:00)
Title: Fix for crash with too many lines / vertices

When a lot of lines are being drawn, this can overflow the vertex buffer, causing a crash in `nvgRenderFlush`. While the underlying code handles this case in an okay manner (truncating the vertex buffer instead of crashing), the `nvgRenderFlush` code is missing a check for this case, causing it to think it has more space than was allocated.

I tried to fix it with multiple buffers as mentioned in #160, however it seems more complex than it appears. This fix just makes it truncate the output according to the actual allocated amount of bytes in the vertex buffer, so it doesn't crash at least.