View more

View more

View more

### Image of the Day Submit

IOTD | Top Screenshots

### The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.

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

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

7 replies to this topic

### #1noatom  Members

Posted 07 September 2013 - 10:24 AM

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, 07 September 2013 - 10:24 AM.

### #2MJP  Moderators

Posted 07 September 2013 - 01:33 PM

The only way to use multiple index buffers is to use multiple draw calls, which is very inefficient.

Why do you want your buffers to all have the same size?

### #3noatom  Members

Posted 07 September 2013 - 03:06 PM

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!

### #4Tispe  Members

Posted 07 September 2013 - 04:15 PM

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.

Posted 07 September 2013 - 05:04 PM

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.

### #6MJP  Moderators

Posted 07 September 2013 - 05:18 PM

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.

### #7Norman Barrows  Members

Posted 08 September 2013 - 06:28 PM

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!).

Norm Barrows

Rockland Software Productions

"Building PC games since 1989"

rocklandsoftware.net

PLAY CAVEMAN NOW!

http://rocklandsoftware.net/beta.php

### #8MaxDZ8  Members

Posted 09 September 2013 - 12:35 AM

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.

Previously "Krohm"

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.