SetTransform()

Started by
4 comments, last by Pseudo 19 years, 1 month ago
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?
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)
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.
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?

Stay Casual,KenDrunken Hyena
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?
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.

This topic is closed to new replies.

Advertisement