Browse Source

Remove commitEye() and fix extra frame of latency in OpenGL as well

Krzysztof Kondrak 9 years ago
parent
commit
0624a5350e
3 changed files with 5 additions and 23 deletions
  1. 5 15
      src/hmd_ovr.cpp
  2. 0 6
      src/hmd_ovr.h
  3. 0 2
      src/renderer_gl.cpp

+ 5 - 15
src/hmd_ovr.cpp

@@ -13,7 +13,6 @@ namespace bgfx
 		: m_hmd(NULL)
 		, m_isenabled(false)
 		, m_mirror(NULL)
-		, m_hmdFrameReady(-1)
 		, m_frameIndex(0)
 		, m_sensorSampleTime(0)
 	{
@@ -125,14 +124,6 @@ namespace bgfx
 		}
 	}
 
-	void OVR::commitEye(uint8_t _eye)
-	{
-		if (m_isenabled)
-		{
-			m_hmdFrameReady = ovr_CommitTextureSwapChain(m_hmd, m_eyeBuffers[_eye]->m_swapTextureChain);
-		}
-	}
-
 	bool OVR::swap(HMD& _hmd, bool originBottomLeft)
 	{
 		_hmd.flags = BGFX_HMD_NONE;
@@ -144,16 +135,15 @@ namespace bgfx
 			_hmd.deviceHeight = m_hmdDesc.Resolution.h;
 		}
 
-		// commit eyes to HMD
-		for (int eye = 0; eye < 2; eye++)
+		if (!m_isenabled)
 		{
-			commitEye(eye);
+			return false;
 		}
 
-		// check that eyes committed successfully
-		if (!m_isenabled || !OVR_SUCCESS(m_hmdFrameReady))
+		// commit eyes to HMD
+		for (int eye = 0; eye < 2; eye++)
 		{
-			return false;
+			ovr_CommitTextureSwapChain(m_hmd, m_eyeBuffers[eye]->m_swapTextureChain);
 		}
 
 		_hmd.flags |= BGFX_HMD_RENDERING;

+ 0 - 6
src/hmd_ovr.h

@@ -72,7 +72,6 @@ namespace bgfx
 		void renderEyeStart(uint8_t _eye);
 		bool postReset();
 		void preReset();
-		void commitEye(uint8_t _eye);
 		bool swap(HMD& _hmd, bool originBottomLeft);
 		void recenter();
 		void getEyePose(HMD& _hmd);
@@ -84,7 +83,6 @@ namespace bgfx
 		ovrPosef    m_pose[2];
 		ovrVector3f m_hmdToEyeOffset[2];
 		ovrSizei    m_hmdSize;
-		ovrResult   m_hmdFrameReady;
 		OVRBufferI *m_eyeBuffers[2];
 		OVRMirrorI *m_mirror;
 		long long   m_frameIndex;
@@ -139,10 +137,6 @@ namespace bgfx
 			_viewport->m_height = 0;
 		}
 
-		void commitEye(uint8_t /*_eye*/)
-		{
-		}
-
 		void renderEyeStart(uint8_t /*_eye*/)
 		{
 		}

+ 0 - 2
src/renderer_gl.cpp

@@ -5658,8 +5658,6 @@ namespace bgfx { namespace gl
 						if (m_ovr.isEnabled() )
 						{
 							m_ovr.getViewport(eye, &viewState.m_rect);
-							// commit previous eye to HMD and start rendering new frame
-							m_ovr.commitEye(eye);
 							m_ovr.renderEyeStart(eye);
 						}
 						else