Sign in to follow this  
Aiursrage2k

Rendering Primatives

Recommended Posts

I have a rather simple world, composed of basic shapes: quads and cubes. Each shape has a texture and a material. When I render the shapes I do so indivually, when a shape is rendered:its streams its source, changes its FVF, texture,etc... Would it be better/faster to take all the shapes, add them to some type of Cache (building a large index buffer --sort them) then rendering the caches. The question then is how slow is SetStreamSource and DrawPrimitive. Is it significantly better to render large chunks of data then rendering the same number of verticies but more render calls... enough to warrant the constant building of the sorted lists? *** I was doing a bit of experimentation and in my world found that changing the render states does not really have an impact.

Share this post


Link to post
Share on other sites
Before I get into the specifics, it is very important to realise that trying to predict performance characteristics of D3D applications is very hit-or-miss. There are so many possible variables and factors that whilst there are some common observations/optimizations it's never guaranteed. You might want to dig up a copy of "PIX for Windows" to do some hardcore profiling - only with instrumentation are you likely to know if A is faster than B [smile]

Quote:
Original post by Aiursrage2k
When I render the shapes I do so indivually, when a shape is rendered:its streams its source, changes its FVF, texture,etc...

How many objects are we talking about here? 10, 20, 100, 5000?

Quote:
Original post by Aiursrage2k
Would it be better/faster to take all the shapes, add them to some type of Cache (building a large index buffer --sort them) then rendering the caches.

Conventional wisdom is that "batching" (the common term for what you're describing) greatly improves performance.

Quote:
Original post by Aiursrage2k
I was doing a bit of experimentation and in my world found that changing the render states does not really have an impact.

It's possible that with a reasonably simple scene, like you've described, that you're just not getting anywhere near the limits of your hardware such that the changes you're making aren't really important. In your instance, it might well be that the extra code/effort you expend implementing these algorithms just won't pay off.

For a more "real-world" like scene/system, the batching process (large chunks of data in few(er) draw calls) is often essential to good performance.

hth
Jack

Share this post


Link to post
Share on other sites

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