bgfx: NanoVG broken when filling large number of vertices

In my app I need to draw complex polygons with lots of nvgLineTo(), and it may require more than 200 thousands vertices (gl->nverts) in the vertex buffer in nvgRenderFlush(). However, the rendered results looks as expected when using the original NanoVG but the same code will render a broken result when switching the backend to bgfx. This only happens when using nvgFill() with lots of nvgLineTo(). Are there limits of transient vertex buffer in bgfx?

PS. Nothing is wrong when using nvgStroke() with the same complex polygon. Only nvgFill() breaks.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 18 (18 by maintainers)

Commits related to this issue

Most upvoted comments

Found the solution. This line should also change to MTLPixelFormatDepth32Float_Stencil8 https://github.com/bkaradzic/bgfx/blob/master/src/renderer_mtl.mm#L584 Now the pixel format is consistent in RendererContextMtl::submit() for iOS.

Too bad this still doesn’t fix the broken nvgFill() issue. 😦