• Advertisement
Sign in to follow this  

How do i deal with vertices and indices scattered in many buffers?

This topic is 1593 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 thought I should make all index/vertex buffers of a fixed size,but just now,at the end i realize the big problem.

 

If I have a mesh that is in 2 vertex buffers,but it's indices in 3 index buffers,how do i deal with that?

Edited by noatom

Share this post


Link to post
Share on other sites
Advertisement

Because someone said nvidia recommends 2mb per buffer.I said what I'm gonna do? create buffers based on what?

 

And everybody said that you shouldn't create 1 buffer per mesh,so i created a simple algorithm that nests multiple meshes untill it fills the buffer(the same for indices).

 

Now i'm in big trouble cause i can't figure how to draw everything!

Share this post


Link to post
Share on other sites

You can append some index data to the vertex structure such that all vertices that belong to the same mesh will know what world matrix to use, and what skeleton hierarchy to VTF etc. You gotta use triangle lists for this I think. This way you can draw the whole buffer (with many meshes) in one drawcall.

Share this post


Link to post
Share on other sites

My suggestion would be that unless you're having performance problems, stick with one vertex buffer and one index buffer per model.

 

In most cases, you don't gain that much performance by packing the data from multiple models into one buffer, and it makes your code significantly more complicated.

Share this post


Link to post
Share on other sites

Yeah I agree with Adam. Batching techniques become important when you start needing thousands of draw calls per frame. If you're not at that number, don't worry about it.  I've never heard of anyone recommending certain sizes for vertex or index buffers, but if it's true I'd imagine that it also only comes into play with many many draw calls.

Share this post


Link to post
Share on other sites

Actually i've seen that nvidia 2 meg thing. but as i recall it was about maximizing theoretical throughput for performance benchmarks.  

 

I'm currently able to do about to 10,000 - 15,000 static meshes, one vb and ib per mesh, with fixed function pipeline (no shaders!).

Share this post


Link to post
Share on other sites

Maybe for dynamic buffers update. There has been a time (NV_VAR) in which everything had to go in a single memory blob. Personally I've never observed any performance difference WRT buffer size for static usage. Not that I benchmarked that in recent years, it just didn't matter.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement