Resrtuctured the use of static's in the Uniform::getNameID() method to avoid problems under Android.
This commit is contained in:
parent
2923c8014a
commit
0eb95f01d8
@ -967,12 +967,13 @@ GLenum Uniform::getInternalArrayType( Type t )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef std::map<std::string, unsigned int> UniformNameIDMap;
|
|
||||||
static OpenThreads::Mutex s_mutex_uniformNameIDMap;
|
|
||||||
static UniformNameIDMap s_uniformNameIDMap;
|
|
||||||
|
|
||||||
unsigned int Uniform::getNameID(const std::string& name)
|
unsigned int Uniform::getNameID(const std::string& name)
|
||||||
{
|
{
|
||||||
|
typedef std::map<std::string, unsigned int> UniformNameIDMap;
|
||||||
|
static OpenThreads::Mutex s_mutex_uniformNameIDMap;
|
||||||
|
static UniformNameIDMap s_uniformNameIDMap;
|
||||||
|
|
||||||
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_uniformNameIDMap);
|
OpenThreads::ScopedLock<OpenThreads::Mutex> lock(s_mutex_uniformNameIDMap);
|
||||||
UniformNameIDMap::iterator it = s_uniformNameIDMap.find(name);
|
UniformNameIDMap::iterator it = s_uniformNameIDMap.find(name);
|
||||||
if (it != s_uniformNameIDMap.end())
|
if (it != s_uniformNameIDMap.end())
|
||||||
@ -984,6 +985,9 @@ unsigned int Uniform::getNameID(const std::string& name)
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use a proxy to force the initialization of the static variables in the Unifrom::getNameID() method during static initialization
|
||||||
|
OSG_INIT_SINGLETON_PROXY(UniformNameIDStaticInitializationProxy, Uniform::getNameID(std::string()))
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// value constructors for single-element (ie: non-array) uniforms
|
// value constructors for single-element (ie: non-array) uniforms
|
||||||
|
@ -70,7 +70,7 @@ static SceneSingleton& getSceneSingleton()
|
|||||||
return s_sceneSingleton;
|
return s_sceneSingleton;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use a proxy to force the initialization of the the SceneSingleton during static initialization
|
// Use a proxy to force the initialization of the SceneSingleton during static initialization
|
||||||
OSG_INIT_SINGLETON_PROXY(SceneSingletonProxy, getSceneSingleton())
|
OSG_INIT_SINGLETON_PROXY(SceneSingletonProxy, getSceneSingleton())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user