This commit is contained in:
Branimir Karadžić 2015-06-05 10:43:43 -07:00
parent f81dadd9b8
commit 466c76071a
4 changed files with 35 additions and 31 deletions

View file

@ -10,9 +10,9 @@
namespace bgfx
{
#if OVR_VERSION <= OVR_VERSION_050
static const int s_eyeBuffer = 100;
# define OVR_EYE_BUFFER 100
#else
static const int s_eyeBuffer = 8;
# define OVR_EYE_BUFFER 8
#endif // OVR_VERSION...
OVR::OVR()
@ -56,7 +56,7 @@ namespace bgfx
ovrSizei sizeL = ovrHmd_GetFovTextureSize(m_hmd, ovrEye_Left, m_hmd->DefaultEyeFov[0], 1.0f);
ovrSizei sizeR = ovrHmd_GetFovTextureSize(m_hmd, ovrEye_Right, m_hmd->DefaultEyeFov[1], 1.0f);
m_rtSize.w = sizeL.w + sizeR.w + s_eyeBuffer;
m_rtSize.w = sizeL.w + sizeR.w + OVR_EYE_BUFFER;
m_rtSize.h = bx::uint32_max(sizeL.h, sizeR.h);
m_warning = true;
}
@ -71,10 +71,10 @@ namespace bgfx
void OVR::getViewport(uint8_t _eye, Rect* _viewport)
{
_viewport->m_width = (m_rtSize.w - s_eyeBuffer)/2;
_viewport->m_x = _eye * (m_rtSize.w + OVR_EYE_BUFFER + 1)/2;
_viewport->m_y = 0;
_viewport->m_width = (m_rtSize.w - OVR_EYE_BUFFER)/2;
_viewport->m_height = m_rtSize.h;
_viewport->m_x = _eye * (m_rtSize.w + s_eyeBuffer + 1)/2;
_viewport->m_y = 0;
}
bool OVR::postReset(void* _nwh, ovrRenderAPIConfig* _config, bool _debug)
@ -183,12 +183,12 @@ ovrError:
ovrRecti rect;
rect.Pos.x = 0;
rect.Pos.y = 0;
rect.Size.w = (m_rtSize.w - s_eyeBuffer)/2;
rect.Size.w = (m_rtSize.w - OVR_EYE_BUFFER)/2;
rect.Size.h = m_rtSize.h;
m_texture[0].Header.RenderViewport = rect;
rect.Pos.x += rect.Size.w + s_eyeBuffer;
rect.Pos.x += rect.Size.w + OVR_EYE_BUFFER;
m_texture[1].Header.RenderViewport = rect;
m_timing = ovrHmd_BeginFrame(m_hmd, 0);

View file

@ -108,14 +108,6 @@ namespace bgfx
{
}
void init()
{
}
void shutdown()
{
}
bool isInitialized() const
{
return false;
@ -131,6 +123,22 @@ namespace bgfx
return false;
}
void init()
{
}
void shutdown()
{
}
void getViewport(uint8_t /*_eye*/, Rect* _viewport)
{
_viewport->m_x = 0;
_viewport->m_y = 0;
_viewport->m_width = 0;
_viewport->m_height = 0;
}
bool swap(HMD& _hmd)
{
_hmd.flags = BGFX_HMD_NONE;

View file

@ -1725,16 +1725,15 @@ BX_PRAGMA_DIAGNOSTIC_POP();
DX_RELEASE(m_swapChain, 0);
SWAP_CHAIN_DESC_TYPE* scd = &m_scd;
#if BGFX_CONFIG_USE_OVR
SWAP_CHAIN_DESC_TYPE swapChainScd;
if ((m_flags & BGFX_RESET_HMD) && m_ovr.isInitialized())
SwapChainDesc* scd = &m_scd;
SwapChainDesc swapChainScd;
if (0 != (m_flags & BGFX_RESET_HMD)
&& m_ovr.isInitialized())
{
swapChainScd = m_scd;
swapChainScd.SampleDesc = s_msaa[0];
scd = &swapChainScd;
}
#endif // BGFX_CONFIG_USE_OVR
#if BX_PLATFORM_WINRT
HRESULT hr;
@ -2713,11 +2712,12 @@ BX_PRAGMA_DIAGNOSTIC_POP();
bool m_wireframe;
#if BX_PLATFORM_WINRT
typedef DXGI_SWAP_CHAIN_DESC1 SWAP_CHAIN_DESC_TYPE;
typedef DXGI_SWAP_CHAIN_DESC1 SwapChainDesc;
#else
typedef DXGI_SWAP_CHAIN_DESC SWAP_CHAIN_DESC_TYPE;
#endif
SWAP_CHAIN_DESC_TYPE m_scd;
typedef DXGI_SWAP_CHAIN_DESC SwapChainDesc;
#endif // BX_PLATFORM_WINRT
SwapChainDesc m_scd;
uint32_t m_flags;
uint32_t m_maxAnisotropy;
@ -3856,13 +3856,11 @@ BX_PRAGMA_DIAGNOSTIC_POP();
PIX_BEGINEVENT(D3DCOLOR_RGBA(0xff, 0x00, 0x00, 0xff), viewNameW);
}
#if BGFX_CONFIG_USE_OVR
if (m_ovr.isEnabled())
if (m_ovr.isEnabled() )
{
m_ovr.getViewport(eye, &viewState.m_rect);
}
else
#endif // BGFX_CONFIG_USE_OVR
{
viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2;
viewState.m_rect.m_width /= 2;

View file

@ -4961,13 +4961,11 @@ namespace bgfx { namespace gl
GL_CHECK(glInsertEventMarker(0, viewName) );
}
#if BGFX_CONFIG_USE_OVR
if (m_ovr.isEnabled())
if (m_ovr.isEnabled() )
{
m_ovr.getViewport(eye, &viewState.m_rect);
}
else
#endif // BGFX_CONFIG_USE_OVR
{
viewState.m_rect.m_x = eye * (viewState.m_rect.m_width+1)/2;
viewState.m_rect.m_width /= 2;