VulkanSceneGraph icon indicating copy to clipboard operation
VulkanSceneGraph copied to clipboard

Re-compiling always allocates minimumBufferSize (16MB) for new buffers

Open TP-David opened this issue 3 months ago • 3 comments

Additional calls to BindIndex/VertexBuffers are not re-using the memory blocks from the previous frame/compilation, causing the minimal size to be allocated for each of them (16MB as defined in MemoryBufferPools.h).

After investigation we localized the issue to a MemoryBufferPools being created each compilation in Viewer::compile (new CompileTraversal->new Context->new CopyAndReleaseBuffer->new MemoryBufferPools). A rudimentary workaround which solves the issue is:

  1. Making deviceResourceMap a member field or static.
  2. Adding if (!deviceResources.compile) before creating a new CompileTraversal

Here's a minimal example demonstrating the issue (and checking the frame commands in RenderDoc). vsgdraw.zip

Would like some feedback on this issue and whether this is a design flaw of VSG, as creating new models on the fly and recompiling should not add a minimum of 16MB.

TP-David avatar Mar 25 '24 16:03 TP-David