Sign in to follow this  

Extra DrawPrimitive or wasted verticies

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

Hey all, I have a bit of a performance question. in our engine we have the ability to draw a filled quad, and a outlined quad. now since these two shapes require different numbers of verticies (and methods of drawing) it requires that we seperate out the filled quads and the outlined quads, this results in two large calls to DrawPrimitive. Would it be better, instead, to formulate the outlined quad, as a serries of four filled quads, so that we could use a single call to DrawPrimitive? there would be more verticies but it wouldnt require us to batch again. also, are there any performance issues with drawing a LineList versus a a Quad ? thoughts?

Share this post


Link to post
Share on other sites
It is really best to just try it both ways and see. It shouldn't be too hard to do.

It depends a lot on how big your primitive lists are and how many times a frame this happens, and the characteristics of your target hardware. I can picture situations where it could go either way.


Share this post


Link to post
Share on other sites
Quote:
Original post by EDI
also, are there any performance issues with drawing a LineList versus a a Quad ?


My understanding is that lines are slower than triangles because of a CAD motovated emphasis on accuracy with lines.

Share this post


Link to post
Share on other sites
I think for the sake of unification i will make a outlined rect be a function of 4 filled rects.

both filled rects and outlined rects are _very_ rare in our usages anyway, so my main goal was just to 'feel okay' about unifying it to simplify our rendering code.

thanks =)

Share this post


Link to post
Share on other sites
In most instances, fewer DrawPrimitive calls is better. That paradigm might be shifting in the future, but for now more vertices really won't hurt anything. But as said, you can't know til you try and test both methods.

Share this post


Link to post
Share on other sites
The driver likely converts your line to a quad anyway, so since you're drawing a small number of them I'd say the cost of the extra DrawPrims would likely be higher than the wasted verts.

But in either case it probably isn't significant, so I'd go with the solution that simplifies your code unless you have reason to believe there is a performance issue there.

Share this post


Link to post
Share on other sites
Excellent =)

Yeah, at first my thought was that the hardware had line rendering capabilities itself, but now that i think about it, i would imagine that the triangle is the paramount primitive for the HW.

at the moment we are also under-batching, i think we might only be pushing 500 quads per frame, so i think grouping as much as we can into fewer DP calls will be good.

thanks again for your help =)

Share this post


Link to post
Share on other sites

This topic is 4662 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.

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