Jump to content
  • Advertisement
Sign in to follow this  
littlekid

Directx Internal Optimization

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

From what I have read so far, directx does a fair amount of optimization. E.g: D3D10Device->IASetInputLayout(A); D3D10Device->IASetInputLayout(B); would result in this as directx optimize by setting a dirty region. D3D10Device->IASetInputLayout(B); What about this scenario: D3D10Device->IASetInputLayout(A); DrawMeshOne(); D3D10Device->IASetInputLayout(A); DrawMeshTwo(); Will directx removes the 2nd similar IASetInputLayout() instruction? Or do I have to optimize them by myself? Reason being that each of my CObject class handles the draw code itselfs meaning CObject::Draw() does this:
CObject::Draw()
{
    IASetInputLayout(CObject::Layout);
    IASetPrimitiveTopology(CObject::Topology);
    
    for each effect pass
        DrawIndexedPrimitive();
}
Hence when many CObject::Draw() are executed, it would lead to the above scenario.

Share this post


Link to post
Share on other sites
Advertisement
The D3D10 runtime generally (and in this case, definitely) turns redundant calls like this into a no-op before it gets to the driver. There is still some overhead in any API call, but it's probably as fast or faster than you checking yourself to see if the handles match.

Share this post


Link to post
Share on other sites
State management and optimization in D3D10 is a lot better than with D3D9. Previously it was a serious concern to all AppDev's to ensure an optimal and efficient interaction with the API, but with D3D10 it can (at least initially) take more of a back seat. As in more conventional optimization - wait until it shows up in your "worst offenders" list before you expend substantial effort on improving it.

Tools like NVPerfHUD are good for trying to identify where the bottlenecks really are. You can start to trace this sort of thing back to the characteristics of your application and hence identify where the code needs attention.


hth
Jack

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!