Branimir Karadžić преди 9 години
родител
ревизия
7092638aea
променени са 3 файла, в които са добавени 48 реда и са изтрити 48 реда
  1. 4 4
      src/hmd.cpp
  2. 44 0
      src/renderer.h
  3. 0 44
      src/renderer_d3d.h

+ 4 - 4
src/hmd.cpp

@@ -60,10 +60,10 @@ namespace bgfx
 
 
 	void VR::getViewport(uint8_t _eye, Rect* _viewport) const
 	void VR::getViewport(uint8_t _eye, Rect* _viewport) const
 	{
 	{
-		_viewport->m_width = m_desc.m_eyeSize[_eye].m_w;
-		_viewport->m_x = _eye * (m_desc.m_eyeSize[_eye].m_w + 1);
-		_viewport->m_height = (uint16_t)m_desc.m_eyeSize[_eye].m_h;
-		_viewport->m_y = 0;
+		_viewport->m_x      = uint16_t(_eye * (m_desc.m_eyeSize[_eye].m_w + 1) );
+		_viewport->m_y      = 0;
+		_viewport->m_width  = uint16_t(m_desc.m_eyeSize[_eye].m_w);
+		_viewport->m_height = uint16_t(m_desc.m_eyeSize[_eye].m_h);
 	}
 	}
 
 
 	void VR::makeRenderTargetActive()
 	void VR::makeRenderTargetActive()

+ 44 - 0
src/renderer.h

@@ -390,6 +390,50 @@ namespace bgfx
 		Data m_data[MaxHandleT];
 		Data m_data[MaxHandleT];
 	};
 	};
 
 
+	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;
+	};
+
 } // namespace bgfx
 } // namespace bgfx
 
 
 #endif // BGFX_RENDERER_H_HEADER_GUARD
 #endif // BGFX_RENDERER_H_HEADER_GUARD

+ 0 - 44
src/renderer_d3d.h

@@ -167,50 +167,6 @@ namespace bgfx
 		HashMap m_hashMap;
 		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<>
 	template<>
 	inline void release<IUnknown*>(IUnknown* _ptr)
 	inline void release<IUnknown*>(IUnknown* _ptr)
 	{
 	{