From 143e3a355d0806339753941a21ea492a5d501982 Mon Sep 17 00:00:00 2001 From: Vincent Lejeune Date: Tue, 28 Jan 2014 20:05:16 +0100 Subject: [PATCH] Display rendered objects count instead of ktris. Things go well untill we have more than 200 objects on my system, no matter how big they are. --- src/graphics/irr_driver.cpp | 10 ++++++++-- src/graphics/irr_driver.hpp | 6 +++++- src/graphics/stkanimatedmesh.cpp | 1 + src/graphics/stkmesh.cpp | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/graphics/irr_driver.cpp b/src/graphics/irr_driver.cpp index 266335ef0..2c4032ef5 100644 --- a/src/graphics/irr_driver.cpp +++ b/src/graphics/irr_driver.cpp @@ -152,6 +152,11 @@ STKRenderingPass IrrDriver::getPhase() const return phase; } +void IrrDriver::IncreaseObjectCount() +{ + object_count[phase]++; +} + core::array &IrrDriver::getMainSetup() { return m_mrt; @@ -1514,8 +1519,9 @@ void IrrDriver::displayFPS() if (UserConfigParams::m_artist_debug_mode) { - sprintf(buffer, "FPS: %i/%i/%i - %.2f/%.2f/%.2f KTris - LightDst : ~%d", - min, fps, max, low, kilotris, high, m_last_light_bucket_distance); + sprintf(buffer, "FPS: %i/%i/%i - Objects (P1:%d P2:%d T:%d) KTris - LightDst : ~%d", + min, fps, max, object_count[SOLID_NORMAL_AND_DEPTH_PASS], object_count[SOLID_NORMAL_AND_DEPTH_PASS], object_count[TRANSPARENT_PASS], m_last_light_bucket_distance); + object_count[SOLID_NORMAL_AND_DEPTH_PASS] = object_count[SOLID_NORMAL_AND_DEPTH_PASS] = object_count[TRANSPARENT_PASS] = 0; } else { diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index 77fbff2e2..db936bba3 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -70,7 +70,8 @@ enum STKRenderingPass TRANSPARENT_PASS, GLOW_PASS, DISPLACEMENT_PASS, - SHADOW_PASS + SHADOW_PASS, + PASS_COUNT, }; /** @@ -164,7 +165,9 @@ private: bool m_shadowviz; bool m_lightviz; bool m_distortviz; + /** Performance stats */ unsigned m_last_light_bucket_distance; + unsigned object_count[PASS_COUNT]; u32 m_renderpass; u32 m_lensflare_query; scene::IMeshSceneNode *m_sun_interposer; @@ -223,6 +226,7 @@ public: void reset(); void setPhase(STKRenderingPass); STKRenderingPass getPhase() const; + void IncreaseObjectCount(); core::array &getMainSetup(); void updateConfigIfRelevant(); void setAllMaterialFlags(scene::IMesh *mesh) const; diff --git a/src/graphics/stkanimatedmesh.cpp b/src/graphics/stkanimatedmesh.cpp index ab10613fb..2f74fc861 100644 --- a/src/graphics/stkanimatedmesh.cpp +++ b/src/graphics/stkanimatedmesh.cpp @@ -160,6 +160,7 @@ void STKAnimatedMesh::render() driver->setTransform(video::ETS_WORLD, AbsoluteTransformation * ((scene::SSkinMeshBuffer*)mb)->Transformation); if (isObjectPass(material.MaterialType)) { + irr_driver->IncreaseObjectCount(); initvaostate(GLmeshes[i], material.MaterialType); if (irr_driver->getPhase() == SOLID_NORMAL_AND_DEPTH_PASS) { diff --git a/src/graphics/stkmesh.cpp b/src/graphics/stkmesh.cpp index 68bab52b9..52347cfef 100644 --- a/src/graphics/stkmesh.cpp +++ b/src/graphics/stkmesh.cpp @@ -949,6 +949,7 @@ void STKMesh::render() } else { + irr_driver->IncreaseObjectCount(); initvaostate(GLmeshes[i], material.MaterialType); if (transparent) drawTransparent(GLmeshes[i], material.MaterialType);