On optimizing dynamic vertex buffers

Started by
1 comment, last by Silex 20 years, 3 months ago
Okay, as I understand it, the best way to render large dynamic vertex buffers is to create one of some size, say 4096 vertices, and divide it into smaller batches, say 1024, so that the graphic card and CPU work in unison rather than one having to wait for other to finish. Okay, now, my questions are as follows: 1. Is there some magic ratio of vb size to batch size? 2. If not, what are the general guidelines in choosing the sizes? 3. If these sizes depend on hardware, as they most likely do, is there a program out there that can do some tests to find the optimal sizes for a particular machine? 4. Why not just have one batch with D3DLOCK_DISCARD instead of having a larger VB to store several batches? Thank you for your time.
Advertisement
C''mon, surely someone out there can help me out!
1) I wish.

2) Generally sending out a 1000 or two at a time is a good idea, it really depends. Like for a particle system I worked on I tried different draw sizes, turned out that on the hardware i was testing it, the optimal draw size was about 400 particles per draw call. It was a small number bcause the CPU didnt have a lot to do either, so by the time the 400 was done rendering, the CPU was also done with the next update. In a proper game teh updating interval would take much longer, so teh batch sizes would probably be bigger. You''ll have to do a lot of testing to find the optimal batch size, but then again, it would be different for different hardware

3) They depend on hardware and on how much game logic (read CPU power) there is (see number 2). And no, there isnt some magic program that can do this to you (I wish there was though) Becuase the otimal size dosnt just depend on th...err, yeah, I think we''ve gone over this. Anyway, optimal size is not static.

4)you can do that. depends on the situation. The SDK docs have a whole page on vertex buffer optimizations, you should check it out. goto:
DirectX Graphics → Programming Guide → Programming tips → Performace optimizations
for a lot of useful tips

| C++ Debug Kit :: GameDev Kit :: DirectX Tutorials :: 2D DX Engine | TripleBuffer Software |
| Plug-in Manager :: System Information Class :: D3D9 Hardware Enum | DevMaster :: FlipCode |

[size=2]aliak.net

This topic is closed to new replies.

Advertisement