Add a bunch of profiling markers. Gives us some idea where time is spent. Not perfect but better than nothing

This commit is contained in:
Marianne Gagnon
2014-01-18 19:48:20 -05:00
parent 2609e5c709
commit 5ce82f9f55
2 changed files with 36 additions and 0 deletions

View File

@@ -31,6 +31,7 @@
#include "race/race_manager.hpp"
#include "tracks/track.hpp"
#include "utils/log.hpp"
#include "utils/profiler.hpp"
#include <SViewFrustum.h>
@@ -574,6 +575,7 @@ void PostProcessing::render()
// As the original color shouldn't be touched, the first effect can't be disabled.
PROFILER_PUSH_CPU_MARKER("- Bloom", 0xFF, 0x00, 0x00);
if (1) // bloom
{
// Blit the base to tmp1
@@ -627,7 +629,9 @@ void PostProcessing::render()
in = irr_driver->getRTT(RTT_TMP1);
out = irr_driver->getRTT(RTT_TMP2);
}
PROFILER_POP_CPU_MARKER();
PROFILER_PUSH_CPU_MARKER("- Godrays", 0xFF, 0x00, 0x00);
if (World::getWorld()->getTrack()->hasGodRays() && m_sunpixels > 30) // god rays
{
// Grab the sky
@@ -710,9 +714,11 @@ void PostProcessing::render()
drawQuad(cam, m_material);
}
PROFILER_POP_CPU_MARKER();
if (UserConfigParams::m_motionblur && m_any_boost) // motion blur
{
PROFILER_PUSH_CPU_MARKER("- Motion blur", 0xFF, 0x00, 0x00);
// Calculate the kart's Y position on screen
const core::vector3df pos =
Camera::getCamera(cam)->getKart()->getNode()->getPosition();
@@ -734,20 +740,24 @@ void PostProcessing::render()
ITexture *tmp = in;
in = out;
out = tmp;
PROFILER_POP_CPU_MARKER();
}
if (irr_driver->getDisplacingNodes().size()) // Displacement
{
PROFILER_PUSH_CPU_MARKER("- Displacement", 0xFF, 0x00, 0x00);
drv->setRenderTarget(out, true, false);
renderPPDisplace(in);
ITexture *tmp = in;
in = out;
out = tmp;
PROFILER_POP_CPU_MARKER();
}
if (UserConfigParams::m_mlaa) // MLAA. Must be the last pp filter.
{
PROFILER_PUSH_CPU_MARKER("- MLAA", 0xFF, 0x00, 0x00);
drv->setRenderTarget(out, false, false);
glEnable(GL_STENCIL_TEST);
@@ -801,6 +811,7 @@ void PostProcessing::render()
// Done.
glDisable(GL_STENCIL_TEST);
PROFILER_POP_CPU_MARKER();
}
// Final blit

View File

@@ -220,6 +220,9 @@ void IrrDriver::renderGLSL(float dt)
//renderShadows(sicb, camnode, overridemat, camera);
}
PROFILER_PUSH_CPU_MARKER("- Light", 0xFF, 0x00, 0x00);
// Lights
renderLights(cambox, camnode, overridemat, cam, dt);
irr_driver->setPhase(1);
@@ -230,6 +233,10 @@ void IrrDriver::renderGLSL(float dt)
m_scene_manager->drawAll(m_renderpass);
glDisable(GL_STENCIL_TEST);
PROFILER_POP_CPU_MARKER();
PROFILER_PUSH_CPU_MARKER("- Glow", 0xFF, 0x00, 0x00);
// Render anything glowing.
if (!m_mipviz && !m_wireframe)
{
@@ -237,13 +244,20 @@ void IrrDriver::renderGLSL(float dt)
renderGlow(overridemat, glows, cambox, cam);
} // end glow
PROFILER_POP_CPU_MARKER();
if (!bgnodes)
{
PROFILER_PUSH_CPU_MARKER("- Skybox", 0xFF, 0x00, 0x00);
// If there are no BG nodes, it's more efficient to do the skybox here.
m_renderpass = scene::ESNRP_SKY_BOX;
m_scene_manager->drawAll(m_renderpass);
PROFILER_POP_CPU_MARKER();
}
PROFILER_PUSH_CPU_MARKER("- Lensflare/godray", 0xFF, 0x00, 0x00);
// Is the lens flare enabled & visible? Check last frame's query.
const bool hasflare = World::getWorld()->getTrack()->hasLensFlare();
const bool hasgodrays = World::getWorld()->getTrack()->hasGodRays();
@@ -270,22 +284,31 @@ void IrrDriver::renderGLSL(float dt)
// Make sure the color mask is reset
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
}
PROFILER_POP_CPU_MARKER();
// Render fog on top of solid
if (World::getWorld()->getTrack()->isFogEnabled())
{
PROFILER_PUSH_CPU_MARKER("- Fog", 0xFF, 0x00, 0x00);
m_post_processing->renderFog(camnode->getAbsolutePosition(), irr_driver->getInvProjViewMatrix());
PROFILER_POP_CPU_MARKER();
}
// We need to re-render camera due to the per-cam-node hack.
PROFILER_PUSH_CPU_MARKER("- SceneManager::drawAll", 0xFF, 0x00, 0x00);
m_renderpass = scene::ESNRP_CAMERA | scene::ESNRP_TRANSPARENT |
scene::ESNRP_TRANSPARENT_EFFECT;
m_scene_manager->drawAll(m_renderpass);
PROFILER_POP_CPU_MARKER();
PROFILER_PUSH_CPU_MARKER("- Displacement", 0xFF, 0x00, 0x00);
// Handle displacing nodes, if any
const u32 displacingcount = m_displacing.size();
if (displacingcount)
{
renderDisplacement(overridemat, cam);
}
PROFILER_POP_CPU_MARKER();
// Drawing for this cam done, cleanup
const u32 glowrepcount = transparent_glow_nodes.size();
@@ -305,8 +328,10 @@ void IrrDriver::renderGLSL(float dt)
World::getWorld()->getPhysics()->draw();
} // for i<world->getNumKarts()
PROFILER_PUSH_CPU_MARKER("Postprocessing", 0xFF, 0x00, 0x00);
// Render the post-processed scene
m_post_processing->render();
PROFILER_POP_CPU_MARKER();
// Set the viewport back to the full screen for race gui
m_video_driver->setViewPort(core::recti(0, 0,