Vertex Array Objects do not need to change when: The same (internal) vertex buffer is still bound.
More...
|
| MultiSourceVertexBufferPool (const VertexElement2VecVec &vertexElementsBySource, size_t maxVertices, BufferType bufferType, size_t internalBufferStart, VaoManager *vaoManager) |
|
virtual | ~MultiSourceVertexBufferPool () |
|
virtual void | createVertexBuffers (VertexBufferPackedVec &outVertexBuffers, size_t numVertices, void *const *initialData, bool keepAsShadow)=0 |
| Creates a vertex buffer based on the given parameters.
|
|
void | destroyVertexBuffers (VertexBufferPackedVec &inOutVertexBuffers) |
| Destroys all the buffers returned from a call to createVertexBuffers.
|
|
size_t | getBytesOffsetToSource (uint8 sourceIdx) const |
|
void | operator delete (void *ptr) |
|
void | operator delete (void *ptr, const char *, int, const char *) |
|
void | operator delete (void *ptr, void *) |
|
void | operator delete[] (void *ptr) |
|
void | operator delete[] (void *ptr, const char *, int, const char *) |
|
void * | operator new (size_t sz) |
|
void * | operator new (size_t sz, const char *file, int line, const char *func) |
| operator new, with debug line info
|
|
void * | operator new (size_t sz, void *ptr) |
| placement operator new
|
|
void * | operator new[] (size_t sz) |
|
void * | operator new[] (size_t sz, const char *file, int line, const char *func) |
| array operator new, with debug line info
|
|
Vertex Array Objects do not need to change when: The same (internal) vertex buffer is still bound.
The same vertex format is still used. The same (internal) index buffer is still bound. This also allows for MultDrawIndirect to render multiple meshes in just one call. Ogre takes care of pretending that multiple different vertex buffers are indepedent when internally we keep everything within the same buffers.
- However multisource buffers (i.e. having position in one buffer, UVs in another) pose a problem: In order to keep using the same VAO, the internal distance between the start (offset) of the position and the start of the UVs in the buffer must remain the same for all the meshes using the same multisource vertex declaration.
- Here's where MultiSourceVertexBufferPool comes into play: We need an extra layer on top of the VaoManager to manage multisource vertex buffers, in addition to the regular memory management the VaoManager already performs.
- First create a MultiSourceVertexBufferPool from the VaoManager, then request the group of vertex buffers to this class.
Creates a vertex buffer based on the given parameters.
Behind the scenes, the vertex buffer is part of much larger vertex buffer, in order to reduce bindings at runtime.
- Parameters
-
outVertexBuffers | [out] A list of the generated vertex buffers, one per buffer source in mVertexElementsPerSource. WARNING: Can be empty if the pool is out of memory or too fragmented to honour this request, in which case you need to use another pool (or free some memory from this pool). |
numVertices | The number of vertices for these vertex buffer. |
initialData | Initial data the buffer will hold upon creation. Can be null (i.e. you plan to upload later). Cannot be null when bufferType is BT_IMMUTABLE. Must have enough room to prevent an overflow. If non-null, the buffer must hold enough data for each vertex buffers. E.g. If mVertexElementsPerSource.size() == 3 then this is valid: initialData = 0; This is also valid: initialData[0] = buffer[numVertices * sumOfBytes(mVertexElementsPerSource[0])]; initialData[1] = 0; //Unless bufferType == BT_IMMUTABLE initialData[2] = buffer[numVertices * sumOfBytes(mVertexElementsPerSource[2])]; |
This is invalid: initialData[0] = whatever; initialData[1] = out of bounds;
- Parameters
-
keepAsShadow | Whether to keep the pointer "initialData" as a shadow copy of the contents. @See BufferPacked::BufferPacked regarding on who is responsible for freeing this pointer and what happens if an exception was raised. |
- Returns
- The desired vertex buffer pointer
Implemented in Ogre::GL3PlusMultiSourceVertexBufferPool, Ogre::GLES2MultiSourceVertexBufferPool, Ogre::MetalMultiSourceVertexBufferPool, and Ogre::NULLMultiSourceVertexBufferPool.