|
|
@@ -167,50 +167,6 @@ namespace bgfx
|
|
|
HashMap m_hashMap;
|
|
|
};
|
|
|
|
|
|
- class StateCache
|
|
|
- {
|
|
|
- public:
|
|
|
- void add(uint64_t _key, uint16_t _value)
|
|
|
- {
|
|
|
- invalidate(_key);
|
|
|
- m_hashMap.insert(stl::make_pair(_key, _value) );
|
|
|
- }
|
|
|
-
|
|
|
- uint16_t find(uint64_t _key)
|
|
|
- {
|
|
|
- HashMap::iterator it = m_hashMap.find(_key);
|
|
|
- if (it != m_hashMap.end() )
|
|
|
- {
|
|
|
- return it->second;
|
|
|
- }
|
|
|
-
|
|
|
- return UINT16_MAX;
|
|
|
- }
|
|
|
-
|
|
|
- void invalidate(uint64_t _key)
|
|
|
- {
|
|
|
- HashMap::iterator it = m_hashMap.find(_key);
|
|
|
- if (it != m_hashMap.end() )
|
|
|
- {
|
|
|
- m_hashMap.erase(it);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- void invalidate()
|
|
|
- {
|
|
|
- m_hashMap.clear();
|
|
|
- }
|
|
|
-
|
|
|
- uint32_t getCount() const
|
|
|
- {
|
|
|
- return uint32_t(m_hashMap.size() );
|
|
|
- }
|
|
|
-
|
|
|
- private:
|
|
|
- typedef stl::unordered_map<uint64_t, uint16_t> HashMap;
|
|
|
- HashMap m_hashMap;
|
|
|
- };
|
|
|
-
|
|
|
template<>
|
|
|
inline void release<IUnknown*>(IUnknown* _ptr)
|
|
|
{
|