Sign in to follow this  

DirectX performance problems

This topic is 4860 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

Hi all, I have a huge performance problem with DirectX 8 right now. I reverse engineered NVidia's NMB file format used for the dawn demo and am now able to render the fairy's mesh without problems (still a lot of work for materials to do though). The thing is: is slow like nothing. I am crawling around at 0.3 fps or so. Since the origibal demo runs nicely on my system I assume it's something with my code. I tried various things such as using only a 1x1 texture or putting all geometry in larger buffers but nothing changed a thing there. Any ideas what might be the problem? Or any ideas about how to narrow down the bottleneck? Any help is greatly appreciated. Cheers, Alex

Share this post


Link to post
Share on other sites
Are you sure your application isn't falling back to using the reference rasterizer?

You may want to look at this list slow operations, and compare it to how many calls of each your are making.

Share this post


Link to post
Share on other sites
The PIX tool, included in the new sdk, is very good in solving d3d pipe performance problems. It can show state change counts per frame, among other relevant info.

That said, I also believe the slowness is due the reference rasterizer - if not, you have seriously bad drawing code somewhere in your program.

Share this post


Link to post
Share on other sites
Cool. I'm definitely going to have a look at that list. Thanks for that.

No, it's not falling back to the reference rasterizer (I am running against the retail runtime - I don't even have the reference rasterizer installed). Besides of that I am running a DX8 app on a DX9 gcard, so that shouldn't happen even if I had the reference rasterizer installed.

Does that PIX tool work for DX8 applications as well? Sounds definitely interesting.

Chers,
Alex

Share this post


Link to post
Share on other sites
Quote:
Original post by DaJudge

Does that PIX tool work for DX8 applications as well? Sounds definitely interesting.


Do try that, and report here if it does. I don't actually have D3d8 apps at my personal machine at the moment, so cannot do that myself.

I consider it very possible, at least technically.

Share this post


Link to post
Share on other sites
Quote:
Original post by Nik02
Quote:
Original post by DaJudge

Does that PIX tool work for DX8 applications as well? Sounds definitely interesting.


Do try that, and report here if it does. I don't actually have D3d8 apps at my personal machine at the moment, so cannot do that myself.

I consider it very possible, at least technically.


Hm. Currently downloading the new SDK. However I doubt that works since the PIX application requires hooks in the D3D-library that most probably aren't present in the DX8 libs... We'll see.

Cheers,
Alex

Share this post


Link to post
Share on other sites
Don't want to post all that stuff here. It's a few times about multiple locking of vertex & index buffers at startup (so it's NOT critical to runtime performance) and during runtime lots of redundant render / texture stage sets. Do you think capturing those redundant stage changes can make a THAT big difference? I honestly don't...

Share this post


Link to post
Share on other sites
How many times do you call Draw[Indexed]Primitive? Are you sorting by material?

Nvidia has an excellent set of slides on finding the bottleneck(s) in your app here:

http://developer.nvidia.com/docs/IO/8230/GDC2003_PipelinePerformance.pdf

It gives you a nice step-by-step flowchart. I highly recommended just going through it.

Share this post


Link to post
Share on other sites
Cool slides. Really helped a lot. I narrowed it down to a vertex transformation bottleneck (Dawn is a HUGE mesh) since it gets faster when I cut instructions there. But the shader (Cg) I am using is only doing transformation and per-vertex diffuse lighting so I can't see how to optimize that.
I am very confused since the Dawn demo itself runs nicely on my machine, so how can a simple diffuse rendering of the mesh be SO slow? Any ideas?

Cheers,
Alex

Share this post


Link to post
Share on other sites
Found a solution... They use multiple triangle strips for one object. Reducing DrawPrimitive() calls by connecting them with degenerate triangles boosts the performance to over 16fps (which is a start at least compared to 0.3fps)...

Next thing I'll try (once I get rid of those degenerate strips that currently come out of my code) is 32-byte aligning of the vertex data.

Cheers,
Alex

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You've probably got a bug in your rendering code so it does more work than it needs to. You should get well over 100fps without bones/textures.

Share this post


Link to post
Share on other sites
Quote:
Original post by DaJudge

Next thing I'll try (once I get rid of those degenerate strips that currently come out of my code) is 32-byte aligning of the vertex data.

Cheers,
Alex


That's probably half your problem. Put those vertices in video memory, not system memory.
You can safely do a DrawIndexedPrimitive for the triangle list, and one call per strip in each object. Just don't change state between them (at least until you texture it).

Share this post


Link to post
Share on other sites
Tried to analyze it with the PIX tool but that can't seem to gather data from Dx8 applications. I can setup the experiment without problems and it also starts the application, but doesn't end on the specified condition (both frame-count or time dependant)...

Gonna try your ideas, thanks.

Share this post


Link to post
Share on other sites

This topic is 4860 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