summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp26
-rw-r--r--tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h12
2 files changed, 38 insertions, 0 deletions
diff --git a/tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp b/tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp
index d49849888..32f97c26a 100644
--- a/tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp
+++ b/tools/emulator/opengl/host/libs/Translator/GLcommon/objectNameManager.cpp
@@ -112,6 +112,20 @@ NameSpace::getGlobalName(unsigned int p_localName)
return 0;
}
+unsigned int
+NameSpace::getLocalName(unsigned int p_globalName)
+{
+ for(NamesMap::iterator it = m_localToGlobalMap.begin(); it != m_localToGlobalMap.end();it++){
+ if((*it).second == p_globalName){
+ // object found - return its local name
+ return (*it).first;
+ }
+ }
+
+ // object does not exist;
+ return 0;
+}
+
void
NameSpace::deleteName(unsigned int p_localName)
{
@@ -190,6 +204,18 @@ ShareGroup::getGlobalName(NamedObjectType p_type, unsigned int p_localName)
return globalName;
}
+unsigned int
+ShareGroup::getLocalName(NamedObjectType p_type, unsigned int p_globalName)
+{
+ if (p_type >= NUM_OBJECT_TYPES) return 0;
+
+ mutex_lock(&m_lock);
+ unsigned int localName = m_nameSpace[p_type]->getLocalName(p_globalName);
+ mutex_unlock(&m_lock);
+
+ return localName;
+}
+
void
ShareGroup::deleteName(NamedObjectType p_type, unsigned int p_localName)
{
diff --git a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h
index ea6afc036..2afc4bcb0 100644
--- a/tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h
+++ b/tools/emulator/opengl/host/libs/Translator/include/GLcommon/objectNameManager.h
@@ -74,6 +74,12 @@ private:
unsigned int getGlobalName(unsigned int p_localName);
//
+ // getLocaalName - returns the local name of an object or 0 if the object
+ // does not exist.
+ //
+ unsigned int getLocalName(unsigned int p_globalName);
+
+ //
// deleteName - deletes and object from the namespace as well as its
// global name from the global name space.
//
@@ -125,6 +131,12 @@ public:
unsigned int getGlobalName(NamedObjectType p_type, unsigned int p_localName);
//
+ // getLocalName - retrieves the "local" name of an object or 0 if the
+ // object does not exist.
+ //
+ unsigned int getLocalName(NamedObjectType p_type, unsigned int p_globalName);
+
+ //
// deleteName - deletes and object from the namespace as well as its
// global name from the global name space.
//