Vertex Buffer

For Vertex Buffers, the VRAM slot is filled by a function of the Effect, and not directly by the engine. The reason for making the Effect responsible of filling the Vertex Buffer is that, should any specific operation be performed on vertices, the Effect will have the opportunity to handle them.

For now, each MeshEffect has a Vertex Buffer, which means that one Mesh may have as many Vertex Buffers as MeshEffects in the Meta-Effect it is associated to.

To get maximum performance out of current graphic hardware which has cache lines of 32 bytes, one needs a vertex size being a multiple of 32 bytes to get best cache use. By having a single buffer per MeshEffect, the MeshEffect creator has the guarantee that its alignment will be preserved. Since his MeshEffect is filling the slot, he's guaranteed that the packing of various attributes will be what he wrote in the filling function. Also, he knows that he only has to care about the vertex attributes he’s declaring in the function which is filling the VRAM buffer from the RAM buffer.

Alternatives I did consider were building a Vertex Buffer containing all vertex attributes required by all MeshEffects of the bound Meta-Effect, and creating a "common" Vertex Buffer, storing data that would be common to all MeshEffects of the bound Meta-Effect. However both have the same problems: they don't guarantee vertex alignment to be a multiple of 32 bytes, and the MeshEffect can't process the data when uploading it to video memory, since it would be an automatic process, so I discarded them both.