Cleanup.
This commit is contained in:
parent
8c50845098
commit
7e016b377f
@ -73,17 +73,17 @@ namespace bgfx
|
||||
|
||||
for (uint32_t ii = 0; ii < 2; ++ii)
|
||||
{
|
||||
if (m_eyeBuffers[ii])
|
||||
if (NULL != m_eyeBuffers[ii])
|
||||
{
|
||||
m_eyeBuffers[ii]->destroy(m_hmd);
|
||||
BX_DELETE(g_allocator, m_eyeBuffers[ii]);
|
||||
m_eyeBuffers[ii] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_mirror)
|
||||
if (NULL != m_mirror)
|
||||
{
|
||||
m_mirror->destroy(m_hmd);
|
||||
BX_DELETE(g_allocator, m_mirror);
|
||||
m_mirror = NULL;
|
||||
}
|
||||
|
||||
ovr_Destroy(m_hmd);
|
||||
@ -127,7 +127,6 @@ namespace bgfx
|
||||
{
|
||||
// on window resize this will recreate the mirror texture in ovrPostReset
|
||||
m_mirror->destroy(m_hmd);
|
||||
BX_DELETE(g_allocator, m_mirror);
|
||||
m_mirror = NULL;
|
||||
m_enabled = false;
|
||||
}
|
||||
|
@ -108,6 +108,15 @@ namespace bgfx
|
||||
{
|
||||
struct OVR
|
||||
{
|
||||
enum Enum
|
||||
{
|
||||
NotEnabled,
|
||||
DeviceLost,
|
||||
Success,
|
||||
|
||||
Count
|
||||
};
|
||||
|
||||
OVR()
|
||||
{
|
||||
}
|
||||
|
@ -3096,18 +3096,18 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
{
|
||||
if (m_ovr.postReset() )
|
||||
{
|
||||
for (int eyeIdx = 0; eyeIdx < ovrEye_Count; eyeIdx++)
|
||||
for (uint32_t ii = 0; ii < 2; ++ii)
|
||||
{
|
||||
// eye buffers need to be initialized only once during application lifetime
|
||||
if (!m_ovr.m_eyeBuffers[eyeIdx])
|
||||
if (NULL == m_ovr.m_eyeBuffers[ii])
|
||||
{
|
||||
m_ovr.m_eyeBuffers[eyeIdx] = BX_NEW(g_allocator, OVRBufferD3D11);
|
||||
m_ovr.m_eyeBuffers[eyeIdx]->create(m_ovr.m_hmd, eyeIdx);
|
||||
m_ovr.m_eyeBuffers[ii] = &m_ovrBuffers[ii];
|
||||
m_ovr.m_eyeBuffers[ii]->create(m_ovr.m_hmd, ii);
|
||||
}
|
||||
}
|
||||
|
||||
// recreate mirror texture
|
||||
m_ovr.m_mirror = BX_NEW(g_allocator, OVRMirrorD3D11);
|
||||
m_ovr.m_mirror = &m_ovrMirror;
|
||||
m_ovr.m_mirror->create(m_ovr.m_hmd, m_resolution.m_width, m_resolution.m_height);
|
||||
}
|
||||
}
|
||||
@ -3509,6 +3509,10 @@ BX_PRAGMA_DIAGNOSTIC_POP();
|
||||
bool m_timerQuerySupport;
|
||||
|
||||
OVR m_ovr;
|
||||
#if BGFX_CONFIG_USE_OVR
|
||||
OVRMirrorD3D11 m_ovrMirror;
|
||||
OVRBufferD3D11 m_ovrBuffers[2];
|
||||
#endif // BGFX_CONFIG_USE_OVR
|
||||
};
|
||||
|
||||
static RendererContextD3D11* s_renderD3D11;
|
||||
|
@ -2860,22 +2860,22 @@ namespace bgfx { namespace gl
|
||||
void ovrPostReset()
|
||||
{
|
||||
#if BGFX_CONFIG_USE_OVR
|
||||
if (m_resolution.m_flags & (BGFX_RESET_HMD | BGFX_RESET_HMD_DEBUG) )
|
||||
if (m_resolution.m_flags & (BGFX_RESET_HMD|BGFX_RESET_HMD_DEBUG) )
|
||||
{
|
||||
if (m_ovr.postReset() )
|
||||
{
|
||||
for (int eyeIdx = 0; eyeIdx < ovrEye_Count; eyeIdx++)
|
||||
for (uint32_t ii = 0; ii < 2; ++ii)
|
||||
{
|
||||
// eye buffers need to be initialized only once during application lifetime
|
||||
if (!m_ovr.m_eyeBuffers[eyeIdx])
|
||||
if (NULL == m_ovr.m_eyeBuffers[ii])
|
||||
{
|
||||
m_ovr.m_eyeBuffers[eyeIdx] = BX_NEW(g_allocator, OVRBufferGL);
|
||||
m_ovr.m_eyeBuffers[eyeIdx]->create(m_ovr.m_hmd, eyeIdx);
|
||||
m_ovr.m_eyeBuffers[ii] = &m_ovrBuffers[ii];
|
||||
m_ovr.m_eyeBuffers[ii]->create(m_ovr.m_hmd, ii);
|
||||
}
|
||||
}
|
||||
|
||||
// recreate mirror texture
|
||||
m_ovr.m_mirror = BX_NEW(g_allocator, OVRMirrorGL);
|
||||
m_ovr.m_mirror = &m_ovrMirror;
|
||||
m_ovr.m_mirror->create(m_ovr.m_hmd, m_resolution.m_width, m_resolution.m_height);
|
||||
}
|
||||
}
|
||||
@ -3309,6 +3309,10 @@ namespace bgfx { namespace gl
|
||||
const char* m_glslVersion;
|
||||
|
||||
OVR m_ovr;
|
||||
#if BGFX_CONFIG_USE_OVR
|
||||
OVRMirrorGL m_ovrMirror;
|
||||
OVRBufferGL m_ovrBuffers[2];
|
||||
#endif // BGFX_CONFIG_USE_OVR
|
||||
};
|
||||
|
||||
RendererContextGL* s_renderGL;
|
||||
|
Loading…
Reference in New Issue
Block a user