Merge pull request #187 from SmilyOrg/patch-2
Fix for crash with too many lines / vertices
This commit is contained in:
commit
cf7b1542d2
@ -30,6 +30,8 @@
|
||||
|
||||
#include <bgfx.h>
|
||||
|
||||
#include <bx\bx.h>
|
||||
|
||||
namespace
|
||||
{
|
||||
#include "vs_nanovg_fill.bin.h"
|
||||
@ -687,6 +689,14 @@ namespace
|
||||
if (gl->ncalls > 0)
|
||||
{
|
||||
bgfx::allocTransientVertexBuffer(&gl->tvb, gl->nverts, s_nvgDecl);
|
||||
|
||||
int allocated = gl->tvb.size/gl->tvb.stride;
|
||||
|
||||
if (allocated < gl->nverts) {
|
||||
gl->nverts = allocated;
|
||||
BX_WARN(true, "Vertex number truncated due to transient vertex buffer overflow");
|
||||
}
|
||||
|
||||
|
||||
memcpy(gl->tvb.data, gl->verts, gl->nverts * sizeof(struct NVGvertex) );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user