From 1b0f2b6cbc7728c2e23382c7887c3995f30b0e8d Mon Sep 17 00:00:00 2001 From: bkaradzic Date: Tue, 26 Jun 2012 22:37:08 -0700 Subject: [PATCH] Cleanup. --- include/bgfx.h | 2 +- src/bgfx.cpp | 4 +--- src/bgfx_p.h | 4 ++-- src/renderer_d3d9.cpp | 10 +++++++--- src/renderer_gl.cpp | 4 ++-- 5 files changed, 13 insertions(+), 11 deletions(-) diff --git a/include/bgfx.h b/include/bgfx.h index 02def5011..8a2548ae1 100644 --- a/include/bgfx.h +++ b/include/bgfx.h @@ -345,7 +345,7 @@ namespace bgfx /// void destroyDynamicIndexBuffer(DynamicIndexBufferHandle _handle); - // + /// DynamicVertexBufferHandle createDynamicVertexBuffer(uint16_t _num, const VertexDecl& _decl); /// diff --git a/src/bgfx.cpp b/src/bgfx.cpp index 10b45b62f..c9ba880e7 100644 --- a/src/bgfx.cpp +++ b/src/bgfx.cpp @@ -341,8 +341,6 @@ namespace bgfx } } - TextVideoMemBlitter g_textVideoMemBlitter; - static const char* s_predefinedName[PredefinedUniform::Count] = { "u_viewRect", @@ -662,7 +660,7 @@ namespace bgfx getCommandBuffer(CommandBuffer::RendererInit); - g_textVideoMemBlitter.init(); + m_textVideoMemBlitter.init(); m_submit->m_transientVb = createTransientVertexBuffer(BGFX_CONFIG_TRANSIENT_VERTEX_BUFFER_SIZE); m_submit->m_transientIb = createTransientIndexBuffer(BGFX_CONFIG_TRANSIENT_INDEX_BUFFER_SIZE); diff --git a/src/bgfx_p.h b/src/bgfx_p.h index fcbb5ece4..f98c2ea5d 100644 --- a/src/bgfx_p.h +++ b/src/bgfx_p.h @@ -290,8 +290,6 @@ namespace bgfx bgfx::MaterialHandle m_material; }; - extern TextVideoMemBlitter g_textVideoMemBlitter; - struct PredefinedUniform { enum Enum @@ -2714,6 +2712,8 @@ namespace bgfx uint32_t m_frames; uint32_t m_debug; + TextVideoMemBlitter m_textVideoMemBlitter; + #if BX_PLATFORM_WINDOWS struct Window { diff --git a/src/renderer_d3d9.cpp b/src/renderer_d3d9.cpp index d237508fb..ee45f1f28 100644 --- a/src/renderer_d3d9.cpp +++ b/src/renderer_d3d9.cpp @@ -2255,11 +2255,15 @@ namespace bgfx next = now + bx::getHPFrequency(); double freq = double(bx::getHPFrequency() ); double toMs = 1000.0/freq; + double elapsedCpuMs = double(elapsed)*toMs; tvm.clear(); uint16_t pos = 10; tvm.printf(10, pos++, 0x8e, " Frame: %3.4f [ms] / %3.2f", frameTime*toMs, freq/frameTime); - tvm.printf(10, pos++, 0x8e, " Draw calls: %4d / %3.4f [ms]", m_render->m_num, elapsed*toMs); + tvm.printf(10, pos++, 0x8e, " Draw calls: %4d / CPU %3.4f [ms]" + , m_render->m_num + , elapsedCpuMs + ); tvm.printf(10, pos++, 0x8e, " Prims: %7d", statsNumPrims); tvm.printf(10, pos++, 0x8e, " Indices: %7d", statsNumIndices); tvm.printf(10, pos++, 0x8e, " DVB size: %7d", m_render->m_vboffset); @@ -2272,7 +2276,7 @@ namespace bgfx tvm.printf(10, pos++, attr[(attrIndex+1)&1], "Render wait: %3.4f [ms]", m_render->m_waitRender*toMs); } - g_textVideoMemBlitter.blit(tvm); + m_textVideoMemBlitter.blit(tvm); PIX_ENDEVENT(); } @@ -2280,7 +2284,7 @@ namespace bgfx { PIX_BEGINEVENT(D3DCOLOR_RGBA(0x40, 0x40, 0x40, 0xff), "debugtext"); - g_textVideoMemBlitter.blit(m_render->m_textVideoMem); + m_textVideoMemBlitter.blit(m_render->m_textVideoMem); PIX_ENDEVENT(); } diff --git a/src/renderer_gl.cpp b/src/renderer_gl.cpp index 7abfb65be..1c793372b 100644 --- a/src/renderer_gl.cpp +++ b/src/renderer_gl.cpp @@ -2428,11 +2428,11 @@ namespace bgfx tvm.printf(10, pos++, attr[(attrIndex+1)&1], "Render wait: %3.4f [ms]", double(m_render->m_waitRender)*toMs); } - g_textVideoMemBlitter.blit(tvm); + m_textVideoMemBlitter.blit(tvm); } else if (m_render->m_debug & BGFX_DEBUG_TEXT) { - g_textVideoMemBlitter.blit(m_render->m_textVideoMem); + m_textVideoMemBlitter.blit(m_render->m_textVideoMem); } GREMEDY_FRAMETERMINATOR();