Moved ctor/dtor into init/shutdown to have class ctor fully initialized prior calling initialization code.

This commit is contained in:
Branimir Karadžić 2014-10-13 21:14:51 -07:00
parent 3b01df7293
commit bfa1f9f3af
3 changed files with 33 additions and 3 deletions

View File

@ -556,6 +556,14 @@ RENDERDOC_IMPORT
, m_vsChanges(0)
, m_fsChanges(0)
, m_rtMsaa(false)
{
}
~RendererContextD3D11()
{
}
void init()
{
m_renderdocdll = loadRenderDoc();
@ -771,7 +779,7 @@ RENDERDOC_IMPORT
postReset();
}
~RendererContextD3D11()
void shutdown()
{
preReset();
@ -2066,11 +2074,13 @@ RENDERDOC_IMPORT
RendererContextI* rendererCreateD3D11()
{
s_renderD3D11 = BX_NEW(g_allocator, RendererContextD3D11);
s_renderD3D11->init();
return s_renderD3D11;
}
void rendererDestroyD3D11()
{
s_renderD3D11->shutdown();
BX_DELETE(g_allocator, s_renderD3D11);
s_renderD3D11 = NULL;
}

View File

@ -272,6 +272,14 @@ namespace bgfx
, m_nvidia(false)
, m_instancing(false)
, m_rtMsaa(false)
{
}
~RendererContextD3D9()
{
}
void init()
{
m_fbh.idx = invalidHandle;
memset(m_uniforms, 0, sizeof(m_uniforms) );
@ -555,7 +563,7 @@ namespace bgfx
m_initialized = true;
}
~RendererContextD3D9()
void shutdown()
{
preReset();
@ -1667,11 +1675,13 @@ namespace bgfx
RendererContextI* rendererCreateD3D9()
{
s_renderD3D9 = BX_NEW(g_allocator, RendererContextD3D9);
s_renderD3D9->init();
return s_renderD3D9;
}
void rendererDestroyD3D9()
{
s_renderD3D9->shutdown();
BX_DELETE(g_allocator, s_renderD3D9);
s_renderD3D9 = NULL;
}

View File

@ -852,6 +852,14 @@ namespace bgfx
, m_hash( (BX_PLATFORM_WINDOWS<<1) | BX_ARCH_64BIT)
, m_backBufferFbo(0)
, m_msaaBackBufferFbo(0)
{
}
~RendererContextGL()
{
}
void init()
{
m_fbh.idx = invalidHandle;
memset(m_uniforms, 0, sizeof(m_uniforms) );
@ -1349,7 +1357,7 @@ namespace bgfx
}
}
~RendererContextGL()
void shutdown()
{
if (m_vaoSupport)
{
@ -2305,11 +2313,13 @@ namespace bgfx
RendererContextI* rendererCreateGL()
{
s_renderGL = BX_NEW(g_allocator, RendererContextGL);
s_renderGL->init();
return s_renderGL;
}
void rendererDestroyGL()
{
s_renderGL->shutdown();
BX_DELETE(g_allocator, s_renderGL);
s_renderGL = NULL;
}