Skip to content

Commit

Permalink
Fix non-deterministic rendering due to background texture loading
Browse files Browse the repository at this point in the history
Signed-off-by: Matias N. Goldberg <[email protected]>
  • Loading branch information
darksylinc committed Nov 27, 2022
1 parent 913efa6 commit aa0207f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ogre2/src/Ogre2Scene.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,21 @@ void Ogre2Scene::StartRendering(Ogre::Camera *_camera)
"Started rendering without first calling Scene::PreRender. "
"See Scene::SetCameraPassCountPerGpuFlush for details");
}

#if OGRE_VERSION_MAJOR != 2 || OGRE_VERSION_MINOR != 1
// OgreNext 2.2+ has a feature where all textures are asynchronously loaded
// by default; and a blank texture will be shown until it's ready.
//
// This is great for low latency interactions & most games; but terrible
// if we want all our simulated frames to be perfect & deterministic
// results
//
// We don't want placeholder textures to be used; thus wait until all
// textures being loaded are done.
Ogre::RenderSystem *renderSys =
this->ogreSceneManager->getDestinationRenderSystem();
renderSys->getTextureGpuManager()->waitForStreamingCompletion();
#endif
}

//////////////////////////////////////////////////
Expand Down

0 comments on commit aa0207f

Please sign in to comment.