Sign in to follow this  
Hannesnisula

Advantage of multiple vertex streams?

Recommended Posts

I'd imagine the only thing that would slow down using multiple vertex streams would be setting them each time. I don't know if they run in parallel, but I've heard nothing to the effect that there are considerable performance hits from setting different ones a number of times.

Share this post


Link to post
Share on other sites
According to NVidia and AMD it is a little bit faster to use just on vertex stream containing all the data instead of multiple streams due to better cache locality.

However, what exactly do you want to do?

Share this post


Link to post
Share on other sites
Quote:
Original post by Bunnz
According to NVidia and AMD it is a little bit faster to use just on vertex stream containing all the data instead of multiple streams due to better cache locality.
Depending on the GPU, it could be much slower - if the input assembler needs to construct a vertex from two sources, then it needs to make at least two reads, which could potentially be twice as slow as using a single stream.

There are cases however, where it's better to use multiple streams that to bloat a single stream or to cause more draw calls, but it depends on the specific case.

Share this post


Link to post
Share on other sites
Quote:
Original post by Evil Steve
Depending on the GPU, it could be much slower - if the input assembler needs to construct a vertex from two sources.


When does the IA do this? Is this related to dynamic vertex buffers or does it also happen for resources where only the GPU has read/write access?

Share this post


Link to post
Share on other sites
This is not related to static/dynamic buffers, IA does it for every vertex it needs to process every time; in theory, drivers could merge multiple vertex streams in a single contiguous one for static geometry, in practice they don't do that.

Share this post


Link to post
Share on other sites
It can be advantagous when you are rendering your geometry in multiple passes that require different inputs.

When you are rendering say a z-prepass or a shadow map, all you generally care about is the position of the vertices, there's no need to pass along the normals, texture coordinates, tangents, and all that.

You could create 2 vertex buffers for each mesh, one with the positions only, and one with everything else to easily combine them. I've never noticed any penalty from having every property split out into its own vertex buffer, and I've noticed speed increases in multi-pass techniques by only rendering with the minimum amount of data required. And there's no need to actually allocate video memory for say the normals of a mesh, until you actually need to use them.

Share this post


Link to post
Share on other sites
Quote:
Original post by andur
It can be advantagous when you are rendering your geometry in multiple passes that require different inputs.

When you are rendering say a z-prepass or a shadow map, all you generally care about is the position of the vertices, there's no need to pass along the normals, texture coordinates, tangents, and all that.

You could create 2 vertex buffers for each mesh, one with the positions only, and one with everything else to easily combine them. I've never noticed any penalty from having every property split out into its own vertex buffer, and I've noticed speed increases in multi-pass techniques by only rendering with the minimum amount of data required. And there's no need to actually allocate video memory for say the normals of a mesh, until you actually need to use them.

Interesting. I never thought about it that way. I guess it is not enough to to have different inputlayouts for the different passes?

Share this post


Link to post
Share on other sites
On modern (i.e. next-gen) consoles there is a significant performance penalty for using multiple streams but it really just depends on how you use it -- it's a very context specific and in some cases algorithm specific thing. Ex: If you're using multiple streams to do vertex blending for facial animation, it's faster to do that than the alternative of hundreds of bones transforming verts.

Also, it's just like Evil Steve said - depends on the GPU and driver set.

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