Jump to content
  • Advertisement
Sign in to follow this  
kuharh

SetTransform()

This topic is 4999 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 plan on using a large number of different transforms for various geometry. I am planing on doing rotation, translation, and scaling in code and never using SetTransform(). To use SetTransform I would have to make many DrawPrimitive() calls. Which way is better... SetTransform() -pros gpu handles math -cons lots of DrawPrimitive() calls Transforms in code -pros reduce calls to DrawPrimitive() -cons cpu handles math Am I missing any thing?

Share this post


Link to post
Share on other sites
Advertisement
What's "lots" of DrawPrimative calls? I would do it the normal drawprimative way first, and only devote the effort if it becomes a performance issue. Doing preemptive performance optimizations is typically a bad idea in my experience.

On the other hand if you're talking about doing like 10000 little objects, with few vertices each, it might make sense. It all boils down to what you consider "lots".

On another note, if all your objects are not using the exact same texture/material/shader/etc then you're going to have to do lots of DP calls anyways. (or at least one per combo of the above)

Share this post


Link to post
Share on other sites
I am already setup handling transforms in my drawing functions(CPU) I would have to change all my code to use SetTransform(). I guess I am asking if SetTransform() is more efficient if each transform only applies to one mesh or should I keep transforms in the CPU.

Share this post


Link to post
Share on other sites
As Pseudo said, it depends on what you're doing. By doing it all on the CPU you're hurting your parallelism which *can* be a huge hit. However if you were working with something like sprites where each object is only 4/6 vertices, then it would be more efficient to do it on the CPU.

However if it's a 1000 poly model, I'd be inclined to hand the work over the the video card. Profiling is the only way to be sure.

Or you can look at it from another direction. Since you have one method working already, does it give you the performance you need? If so, what are you worried about?

Share this post


Link to post
Share on other sites
I am working with sprites and small models. But I think I get the point. If my CPU use is too high I should switch to SetTransform(). How can I gauge GPU usage?

Share this post


Link to post
Share on other sites
Well you're CPU will probably be pegged at 100% either way, but the real indicator is frames per second. If your FPS is acceptibly high, then leave it as is, on the other hand if you are getting bad FPS (say <30fps), you may want to devote the time needed to switch to SetTransform. Its hard to tell which would be faster, but if your models are really small then CPU may be better.

If you are using a lot of sprites, then you might want to try using D3D's point sprites. They are optimized fairly well.

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!