Closed tfvlrue closed 5 years ago
Hi,
vg-renderer uses bgfx::makeRef to pass vertex and index buffer data to bgfx. According to the docs,
Data passed must be available for at least 2 bgfx::frame calls
Can you try calling bgfx::frame() a couple of times before calling vg::destroyContext()?
For the record, the shutdown order you posted is correct because vg-renderer depends on bgfx and not the opposite (bgfx doesn't know about vg-renderer).
Hope that helps.
Aha, that did the trick! Thanks for the quick response.
Hi, Just started playing around with this library and bgfx for the first time and having trouble getting it to shutdown cleanly. It seems like vg and bgfx are each dependent on the other shutting down first and I'm not sure how to resolve it.
Here's the essence of what I'm trying. First, initialization:
Then render a square:
Finally, shutdown:
If I destroy the vg context first, then bgfx's render thread tries to release (via releaseIndexBufferCallback) an index buffer that vg has already freed. If I shutdown bgfx first, then vg::destroyContext tries to destroy programs that bgfx has already freed. If I don't destroy the vg context, then bgfx complains about a bunch of leaked handles on shutdown.
Any assistance sorting this out is much appreciated. Thanks!