Can I extend a vertex buffer in DirectX 12 (actually SharpDX with DX12)?
I am already set up and happily rendering along when I suddenly realise I need more vertices to render.
- I could of course scrap the vertex buffer and create a new, larger one, but the problem is that I have already discarded my vertex data on the CPU side, to save memory.
- So... I could create another vertex buffer instead and make sure to use both, one after the other, when rendering my frames. That would be OK, but what if I need to do this extension 1000 times? I would end up with 1001 vertex buffers, and I guess that would really kill performance.
- What if I could simply extend my vertex buffer? Is there a way? Let me guess the answer here. I'm guessing there isn't. But maybe there is a way to copy the older vertex buffer into a new larger one? I have already used an upload buffer and copied it to my vertex buffer. Can I simply use the same technique for copying my old vertex buffer into a new one? Does anyone have an example code where this is being done? Well, if I can't extend my vertex buffer in place, I guess this is what I will try instead.
Have a great weekend!