ATI / NVIDIA Performance Issues

Started by
11 comments, last by weasalmongler 18 years, 9 months ago
Quote:Original post by weasalmongler
If I put them into a static buffer then I am unable to move them around. I would have to do one call to DrawIndexedPrimitive as I would have to change the modelview matrix. By performing the transformations myself on the CPU, I eliminate this problem.


I see. Like AndyTX said, it sounds like you need to look into instancing techniques, if you really want to draw a large number of independently moving objects with a single DrawPrim call. With the right instancing scheme, you should theoretically be able to make a good optimization by saving a lot of the overhead of the dynamic buffer.

But also, even if you are using a dynamic buffer, why are you calling CreateVertexBuffer every frame? You can create it once and fill it over and over. Maybe that is the source of your problems?
Advertisement
You should never create a vb every frame. As Brian Fellows would say 'THAT's CRAZY!!'. ;)

Using a dynamic buffer itself shouldn't be a big hit, but creating index and/or vertex buffers each frame is a big hit - and there are no guarantees how long this might take.

Let me guess - you aren't sure how big the buffer needs to be b/c you don't know how many items will be in view?

If so, treat your dynamicvb as a staging area, and keep lock(), write, unlock() for each object, and then draw() when it's full or you need to change texture, or the frame is over. When you draw b/c it's full, you need to re-lock with discard and keep going.

I just rewrote the way the program allocates the dynamic vertex buffer, so now we create a large one at the start of the program and deallocate at the end. Any time inbetween it is simply locked and unlocked to write data to it.

This has given me a huge performance enhancement. It has gone from pretty much a constant 70 - 100 FPS to an amazing 150 - 400 FPS with literally loads of enemies and other ships all over the place. I still have a bit of optimising to do but I think I can sort it now that I have established the cause of the problem.

Many thanks to everyone who helped with this issue.

- James

This topic is closed to new replies.

Advertisement