Sign in to follow this  

DirectX performance

This topic is 4688 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

This topic is 4688 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this