DirectX performance

Started by
5 comments, last by DevLiquidKnight 19 years, 2 months ago
I've been tracking down some performance issues with our app. The app renders shaded surface polygons (triangles). Currently, the code processes a set of vertices and renders the polygons. This occurs in a loop until all of the vertices have been rendered. This works fine for small numbers of shaded surfaces. However, at or above 1000 surfaces, the app performance degrades. It really slows done. My instincts tell me that we're losing performance by rendering subsets of vertices in a loop rather than batching them up and rendering one time. Can someone verify my suspicions?
Gort...Klaatu, Barada Nikto!
Advertisement
Check out this great slideset on batching. It really goes through a lot of the do's and don't of rendering.

Also, how much performance are you losing, exactly? You have to keep in mind that the importance of FPS is not linear - going from 1000fps to 500fps is not nearly as substantial as going from 100fps to 50fps.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Yes, batch things. From what I have seen, you should see a decent performance gain. I am not sure on all the specifics, but I would say batch at least 1000+ polys per rendering call. With more recent hardware, that might be a lot higher. I would be interested in seeing some numbers here...
On that note i can ask summet.

I'm writing a font engine and when the number of vertices to be display gets to about 8000 the frame rate approaches 60. This clearly isn't right and it definately isnthe hardware :S.

I'm trying to get to the root of the problem, its nothing obvious.

Also i take pleasure in finding that the framerate of the source mennu interface etc drop drastically the more windows u open, like servers, create server, friends etc. I also note that this must because of calculations to do with the windows.

ace
The point of batching is to cut down on the overhead of the call. Every batch you submit (i.e. Every Draw*Primitive call) incurs a lot of processing in the driver (and D3D). Sending polygons with the same state in multiple batches means you are doing the same processing several times over. Clearly this is not optimal.
Actually, if you don't change the state between calls then it's not expensive because it's not doing all the same stuff again.

Of course, if you call DrawPrim twice without changing any states, then it's very likely you are rendering the exact same thing and thus not accomplishing anything useful.

Also, the optimal number of tris per batch depends on a few things. If you look at their benchmark chart in those slides linked above, most of the cards were optimally utilized in the 400-500 tri per batch range. However, if your triangles are large and/or expensive, then the number goes down. If you have recent card, then the number goes up. If your vertex size if large, then you start to run in to other problems if you have large VBs.

also... if you got a rather big 3d game creating a frustrum really increases performance. more info here

This topic is closed to new replies.

Advertisement