Hi !
Ogre::HardwareVertexBuffer and HardwareIndexBuffer have a "bool useShadowBuffer" in the constructor for better reading speed by keeping a copy of the vertexdata in main-ram as well, an option in the MeshManager to enable that by default when loading meshes from file would be nice.
read access to meshdata is often needed for batching and for things like mousepicking and physics as well, maybe even for mesh-animation.
edit : can the shadowbuffers be safely read from a thread ? this would allow collecting batch-data in a main-ram buffer in the background before sending it to the gpu.
MeshManager : option to avoid reading back from vram
- ghoulsblade
- Halfling
- Posts: 86
- Joined: Sun Mar 05, 2006 2:55 pm
- Location: Germany
- x 2
- ghoulsblade
- Halfling
- Posts: 86
- Joined: Sun Mar 05, 2006 2:55 pm
- Location: Germany
- x 2
i just ran into an interesting problem.
when meshes are only used to be assembled in batches, there is no real need to ever load the original mesh-data into vram, but there is currently no way to loading an ogre mesh to ram instead of vram, except for writing a custom mesh loader.
inheriting from the existing meshloader (Ogre::MeshSerializerImpl) is not possible for two reasons :
a) it is _OgrePrivate (class _OgrePrivate MeshSerializerImpl : public Serializer)
b) the file-format-logic isn't seperated from MeshBuffer allocation/writing
one solution i could imagine, is a special option for the HardwareBufferManager to not allocate anything in vram, and only keep it in CPU-ram.
The Ogre::HardwareBuffer constructor parameter "systemMemory" hints at this being at least partially implemented, but i couldn't find any docs or options for HardwareBufferManager or MeshManager to use this when loading, but i think it would be a nice addition for some cases.
when meshes are only used to be assembled in batches, there is no real need to ever load the original mesh-data into vram, but there is currently no way to loading an ogre mesh to ram instead of vram, except for writing a custom mesh loader.
inheriting from the existing meshloader (Ogre::MeshSerializerImpl) is not possible for two reasons :
a) it is _OgrePrivate (class _OgrePrivate MeshSerializerImpl : public Serializer)
b) the file-format-logic isn't seperated from MeshBuffer allocation/writing
one solution i could imagine, is a special option for the HardwareBufferManager to not allocate anything in vram, and only keep it in CPU-ram.
The Ogre::HardwareBuffer constructor parameter "systemMemory" hints at this being at least partially implemented, but i couldn't find any docs or options for HardwareBufferManager or MeshManager to use this when loading, but i think it would be a nice addition for some cases.
- xavier
- OGRE Retired Moderator

- Posts: 9481
- Joined: Fri Feb 18, 2005 2:03 am
- Location: Dublin, CA, US
- x 22
Re: MeshManager : option to avoid reading back from vram
Shadowbuffers do not update from VRAM, so they are true read-only resources -- and anything that is read-only is 100% thread-safe.ghoulsblade wrote: edit : can the shadowbuffers be safely read from a thread ?
- xavier
- OGRE Retired Moderator

- Posts: 9481
- Joined: Fri Feb 18, 2005 2:03 am
- Location: Dublin, CA, US
- x 22
http://www.ogre3d.org/docs/api/html/cla ... hManagera3ghoulsblade wrote:i just ran into an interesting problem.
when meshes are only used to be assembled in batches, there is no real need to ever load the original mesh-data into vram, but there is currently no way to loading an ogre mesh to ram instead of vram, except for writing a custom mesh loader.
inheriting from the existing meshloader (Ogre::MeshSerializerImpl) is not possible for two reasons :
a) it is _OgrePrivate (class _OgrePrivate MeshSerializerImpl : public Serializer)
b) the file-format-logic isn't seperated from MeshBuffer allocation/writing
one solution i could imagine, is a special option for the HardwareBufferManager to not allocate anything in vram, and only keep it in CPU-ram.
The Ogre::HardwareBuffer constructor parameter "systemMemory" hints at this being at least partially implemented, but i couldn't find any docs or options for HardwareBufferManager or MeshManager to use this when loading, but i think it would be a nice addition for some cases.
Load your meshes at your leisure, with the usage flags you need to put it into system RAM.
- ghoulsblade
- Halfling
- Posts: 86
- Joined: Sun Mar 05, 2006 2:55 pm
- Location: Germany
- x 2
ah, cool, this solves the first problem i posted here, thanks =)
but the second one (avoiding allocation of vram) remains,
possible usage flags are
but all of them are for VRAM, and
only allows me to make a COPY of the data in RAM, but not to avoid loading it to vram.
i meant the Ogre::HardwareBuffer constructor parameter systemMemory would be interesting for that, but they aren't meant to be constructed directly, and i couldn't find anything for that in the HardwareBufferManager...
but the second one (avoiding allocation of vram) remains,
possible usage flags are
Code: Select all
HBU_STATIC HBU_DYNAMIC HBU_WRITE_ONLY HBU_DISCARDABLE HBU_STATIC_WRITE_ONLY HBU_DYNAMIC_WRITE_ONLY HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE Code: Select all
bool vertexBufferShadowed = true,
bool indexBufferShadowed = truei meant the Ogre::HardwareBuffer constructor parameter systemMemory
Code: Select all
Ogre::HardwareBuffer::HardwareBuffer ( Usage usage,
bool systemMemory,
bool useShadowBuffer
) 