Jump to content
  • Advertisement
Sign in to follow this  

Lack Of Performance: What might i by doing wrong?

This topic is 4605 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, Whenever i write a DirectX rendering engine i never seem to get the performance that is expected, in fact it seems i never even get close. My engine for now simply renders quads and nothing else. Here is a basic overview of how my static scene is built and rendered. 1) All quad descriptions are parsed from a file into a quad manager. 2) A Scene class runs through all of the quads in the quad manager and then does three things. a) The pointers in the quad manager are sorted by material id. This is a string. b) A vector of structs is filled with information about batches. Batched by texture. This minimises DIP calls to only the number of textures. c) 1 index buffer and 1 vertex buffer are built. 3) In the main loop the Scene class sets the VB and IB to the device and runs through the batches. Now in testing i had 1000 quads described in the file. The engine builds this into an IB with 6000 indices and a VB with 4000 vertices. With this load i get about 60fps. Isn't this awefully slow? Since i am building a static scene here the above is done once and all that is done per-frame is one DIP call (since they only use 1 material for now) for 2000 triangles. I worked out that the throughput of my renderer here is ~120000 triangles per second. I should be pushing through 30,000,000 according to some recent engine specs i found. So if you can think of any obvious reasons i might be getting hopeless throughput i'd be glad to here them. Thanks, ace

Share this post


Link to post
Share on other sites
Advertisement
Hmm if I understand right, you re-build your buffers every frame ? That's what takes time. Try with static buffers, you'll probably have a lot more FPS ^^

Also, the structs you use in the vector : try to make your struct 16 bits aligned, and use an optimized version of vector (I assume you're using the std one. Try making your own one taking advantage of the struct alignment) it might run a little faster.

Share this post


Link to post
Share on other sites
Actually i'm not rebuilding the buffer each frame, sorry if it read that way. It seems optimising std::vector is of little importance now. There must be a bigger bottleneck somewhere.

ace

Share this post


Link to post
Share on other sites
Your engine will stick to 60fps if that's your monitor's refresh rate and VSync is on. So, first make sure your VSync is off.

Also, what primitives are you rendering? Triangle lists? Strips? Are you sending many of 'm together in one batch, or are you drawing one quad per primitive call?
(You can combine primitives using degenerate triangles).

Share this post


Link to post
Share on other sites
Two things off the top of my head: You don't have vertical sync enabled, and also if you double the triangle count - what happens to the framerate?

Share this post


Link to post
Share on other sites
I'm rendering them as a triangle list, 2000 triangles in a batch and presentation interval is set to immediate.

ace

Share this post


Link to post
Share on other sites
Quote:
Original post by Source
Two things off the top of my head: You don't have vertical sync enabled, and also if you double the triangle count - what happens to the framerate?


I can't answer that right now for sure because i'm not in front of the work, but off the top of my head the framerate halves, i think.

ace

Share this post


Link to post
Share on other sites
Not to imply that you don't know what you're doing, since I got a feeling that you know your way just fine, I'd recheck the VSync thing. Run the program with PIX and see that you really call the SetRS with the correct parameter, and that you don't call it again with 'default' or something else that would enable vsync again. That 60FPS number is way too "refresh rate"-y to imply that your VSync is on. From the description of your scene I think you should be closer to 400FPS.

Share this post


Link to post
Share on other sites
With regards to the VSync thing... it's worth baring in mind that most Nvidia/ATI driver control panels that I've seen allow for a forced override. I know that the 9800 pro I've got now can go from "Always Off" -> "Application Preference" -> "Always On". If I switch to the stock "Quality" profile then it sets the VSYNC to "Always On".

Might be worth checking that your driver isn't ignoring your application [wink]

hth
Jack

Share this post


Link to post
Share on other sites
Thanks for the help so far,

I can reassure you that this isn't a vsync problem. It does run at like 600FPS when i have less quads. I use FRAPS to determine this. It most certainly isn't snapping to the illustrious 60fps [smile].

ace

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!