mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 03:39:55 +00:00
Make suspending viewer threads the responsibility of the caller, not the shader manager.
This commit is contained in:
parent
229cc9696f
commit
b08938485f
@ -244,7 +244,8 @@ namespace MWRender
|
||||
for (auto itr = shadowDefines.begin(); itr != shadowDefines.end(); itr++)
|
||||
globalDefines[itr->first] = itr->second;
|
||||
|
||||
mResourceSystem->getSceneManager()->getShaderManager().setGlobalDefines(globalDefines, mViewer);
|
||||
// It is unnecessary to stop/start the viewer as no frames are being rendered yet.
|
||||
mResourceSystem->getSceneManager()->getShaderManager().setGlobalDefines(globalDefines);
|
||||
|
||||
mPathgrid.reset(new Pathgrid(mRootNode));
|
||||
|
||||
|
@ -337,12 +337,9 @@ namespace Shader
|
||||
return DefineMap(mGlobalDefines);
|
||||
}
|
||||
|
||||
void ShaderManager::setGlobalDefines(DefineMap & defines, osg::ref_ptr<osgViewer::Viewer> viewer)
|
||||
void ShaderManager::setGlobalDefines(DefineMap & globalDefines)
|
||||
{
|
||||
mGlobalDefines = defines;
|
||||
bool threadsStarted = viewer->areThreadsRunning();
|
||||
if (threadsStarted)
|
||||
viewer->stopThreading();
|
||||
mGlobalDefines = globalDefines;
|
||||
for (auto shaderMapElement: mShaders)
|
||||
{
|
||||
std::string templateId = shaderMapElement.first.first;
|
||||
@ -358,8 +355,6 @@ namespace Shader
|
||||
continue;
|
||||
shader->setShaderSource(shaderSource);
|
||||
}
|
||||
if (threadsStarted)
|
||||
viewer->startThreading();
|
||||
}
|
||||
|
||||
void ShaderManager::releaseGLObjects(osg::State *state)
|
||||
|
@ -39,7 +39,8 @@ namespace Shader
|
||||
|
||||
/// Set the DefineMap used to construct all shaders
|
||||
/// @param defines The DefineMap to use
|
||||
void setGlobalDefines(DefineMap & defines, osg::ref_ptr<osgViewer::Viewer> viewer);
|
||||
/// @note This will change the source code for any shaders already created, potentially causing problems if they're being used to render a frame. It is recommended that any associated Viewers have their threading stopped while this function is running if any shaders are in use.
|
||||
void setGlobalDefines(DefineMap & globalDefines);
|
||||
|
||||
void releaseGLObjects(osg::State* state);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user