I am new to DirectX and currently I'm trying to use it for data visualization, to be specific, a 3D scatter plot. There are very limited resources on the internet, and I have read part of Frank D Luna's book as suggested by many. I studied some samples provided by Microsoft and finally have a grasp on how the loops work inside programs.
However, since I need to manipulate a huge amount of data and require performance as much as possible, I run into something that I hardly find reference with current material.
- Buffer Usage I expect the points I plot to be constant after they are created, but the creation of points happens all the time, should I set the D3D11_USAGE to Default or Dynamic, and which method to call when I need to update the buffer? I have noticed How to use UpdateSubresource and Map/Unmap?, and the presentation https://developer.nvidia.com/sites/default/files/akamai/gamedev/files/gdc12/Efficient_Buffer_Management_McDonald.pdf by NVIDIA. But what should I do if I do need frequent updates of buffer, while no update for each data in the buffer needed?
I noticed in the example "Simple Direct3D game" by Microsoft, it seem to rewrite the entire buffer each time it is updated.
auto objects = m_game->RenderObjects(); for (auto object = objects.begin(); object != objects.end(); object++) { (*object)->Render(d3dContext, m_constantBufferChangesEveryPrim.Get()); }
Is it really so? And How should I only add new vertices into the buffer every time updating it?
Since the program is expected to run very fast, the buffer is expected to be updated much faster than once per frame. Can I write a method to update the buffer and add a new point into the buffer every time I call it? If I could, can I put it in another thread or is there any better method to realize it?
In the example the main loop of the game seems to be in GameMain::StartRenderLoop(), is this loop running once per frame? And what determines the frequency of the loop?
I might have many misconception on frame and rendering, so thank you very much for the patience and answers.