PDA

View Full Version : a big vertex array or a ser of small vertex array?



lovemort
09-04-2013, 05:24 PM
*a big vertex array or a set of small vertex array?

hi all, i'm implementing a LOD mesh and i can store the LODs as indices of a single big vertex array or as a copy of only the used vertices i.e. a set of vertex arrays, the first approach saves a lot of memmory but im not sure it is slower that the second, well , the question : is it slow to use a big vertex array even if there are few indices?
sorry for my bad english hehe

Alfonse Reinheart
09-04-2013, 08:36 PM
This is a pretty legitimate question. However, there really is no answer.

Yes, generally speaking, if you put the LODs in their own memory, the pre-VS caching behavior will be much improved. You won't be jumping around from memory location to memory location as much; every cache line fetch will be important for what you're rendering.

However, if a single vertex in your vertex format is already at least one cache line in size (32 or possibly 64 bytes, depending on the hardware), then the caching behavior will be irrelevant (unless the hardware implements an L2 cache on the vertex fetching hardware. I have no idea if that's a common practice). So if each vertex is cache-line aligned, each fetch will already be a cache-line fetch. So you wouldn't get much from caching behavior anyway.

So there's no way to be certain if there is actually any performance difference. You'll have to profile it on your hardware of interest.

thokra
09-05-2013, 03:50 AM
the first approach saves a lot of memory

Just to be clear here, how much memory are we talking? Assuming a standard 512MB (or possibly even 1GB, depending on your vantage point) of memory, you can push a lot of geometry in there. What is your use case? How much data are you expecting?

lovemort
09-05-2013, 12:12 PM
thanks for reply, using a single vertex array I have n vertices on memory, if the difference between two contiguous LODs is a single vertex then the second approach requires n + (n-1) + (n-2) + (n-3) +... vertices! when i can have only n ,

thokra
09-05-2013, 12:42 PM
... how big is your n ... and how many ns do you have?