diff --git a/src/renderer_d3d11.cpp b/src/renderer_d3d11.cpp index ac8226d9..93b65a7a 100644 --- a/src/renderer_d3d11.cpp +++ b/src/renderer_d3d11.cpp @@ -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; } diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index 923f53a0..763a0e01 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -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; } diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index aadb085f..9f179e51 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -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; }