Hi everyone. I'm dealing with an issue at the moment which occurs specifically on Windows when using the OpenGL3 renderer. When I shut my project down with Ogre::Root::shutdown I get an endless wait in the GL3PlusStagingBuffer::wait function, as it looks like Ogre's waiting for OpenGL to confirm buffers have been destroyed. I've narrowed this down to my custom voxeliser which produces meshes from voxel data, for example
Code: Select all
Ogre::MeshPtr RegionBufferEntry::generateMesh(const std::string& meshName, AV::uint32 width, AV::uint32 height, int maxAltitude){
if(mNumActiveVox == 0){
Ogre::MeshPtr out;
out.reset();
return out;
}
std::string totalName = meshName;
totalName += "-region";
totalName += std::to_string((int)mId);
Ogre::MeshPtr mesh = Ogre::MeshManager::getSingleton().createManual(totalName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
Ogre::SubMesh* subMesh = mesh->createSubMesh();
AV::uint32 vertBlocks = mNumVerts / 4;
//TODO properly set the indice stride to either be 16 or 32 bit.
static const size_t indiceStride = 4;
void* indices = OGRE_MALLOC_SIMD(static_cast<size_t>(vertBlocks * 6 * indiceStride), Ogre::MEMCATEGORY_GEOMETRY);
AV::uint32* indicesPtr = static_cast<AV::uint32*>(indices);
//size_t indiceStride = (vertBlocks * 6 * 4) + 4 >= 0xFFFF ? 4 : 2;
for(AV::uint32 i = 0; i < vertBlocks; i++){
AV::uint32 currIndex = i * 4;
*(indicesPtr++) = currIndex + 0;
*(indicesPtr++) = currIndex + 1;
*(indicesPtr++) = currIndex + 2;
*(indicesPtr++) = currIndex + 2;
*(indicesPtr++) = currIndex + 3;
*(indicesPtr++) = currIndex + 0;
}
Ogre::VertexBufferPacked *vertexBuffer = 0;
Ogre::RenderSystem *renderSystem = Ogre::Root::getSingletonPtr()->getRenderSystem();
Ogre::VaoManager *vaoManager = renderSystem->getVaoManager();
try{
vertexBuffer = vaoManager->createVertexBuffer(elemVec, mNumVerts, Ogre::BT_DEFAULT, mVerts, true);
}catch(Ogre::Exception &e){
vertexBuffer = 0;
}
Ogre::IndexBufferPacked* indexBuffer = vaoManager->createIndexBuffer(Ogre::IndexType::IT_32BIT, vertBlocks * 6, Ogre::BT_IMMUTABLE, indices, false);
Ogre::VertexBufferPackedVec vertexBuffers;
vertexBuffers.push_back(vertexBuffer);
Ogre::VertexArrayObject* arrayObj = vaoManager->createVertexArrayObject(vertexBuffers, indexBuffer, Ogre::OT_TRIANGLE_LIST);
subMesh->mVao[Ogre::VpNormal].push_back(arrayObj);
subMesh->mVao[Ogre::VpShadow].push_back(arrayObj);
const Ogre::Vector3 halfBounds((mMaxX - mMinX) / 2, -(mMaxY - mMinY) / 2, maxAltitude/2);
const Ogre::Aabb bounds(halfBounds, halfBounds);
mesh->_setBounds(bounds);
mesh->_setBoundingSphereRadius(bounds.getRadius());
subMesh->setMaterialName("baseVoxelMaterial");
return mesh;
}
The full code is here https://github.com/OtherMythos/Procedur ... eliser.cpp
I've found that if I never create the custom mesh this hang does not happen. I'm using Ogre-next 3.0 and Windows 10. I've also found this does not occur when using the Vulkan render system. Would anyone be able to suggest anything I could check for this? Thanks.