Profiler: Fix the rendering and use finer grain.

This commit is contained in:
Vincent Lejeune
2014-01-20 20:06:04 +01:00
parent 260f4f148d
commit aeba31c4cf
2 changed files with 16 additions and 5 deletions

View File

@@ -192,6 +192,7 @@ void IrrDriver::renderGLSL(float dt)
// Fire up the MRT
m_video_driver->setRenderTarget(m_mrt, false, false);
PROFILER_PUSH_CPU_MARKER("- Solid Pass 1", 0xFF, 0x00, 0x00);
m_renderpass = scene::ESNRP_CAMERA | scene::ESNRP_SOLID;
irr_driver->setPhase(0);
glClear(GL_STENCIL_BUFFER_BIT);
@@ -205,6 +206,8 @@ void IrrDriver::renderGLSL(float dt)
irr_driver->setViewMatrix(irr_driver->getVideoDriver()->getTransform(video::ETS_VIEW));
irr_driver->genProjViewMatrix();
PROFILER_POP_CPU_MARKER();
// Todo : reenable glow and shadows
//ShadowImportanceProvider * const sicb = (ShadowImportanceProvider *)
// irr_driver->getCallback(ES_SHADOW_IMPORTANCE);
@@ -225,6 +228,9 @@ void IrrDriver::renderGLSL(float dt)
// Lights
renderLights(cambox, camnode, overridemat, cam, dt);
PROFILER_POP_CPU_MARKER();
PROFILER_PUSH_CPU_MARKER("- Solid Pass 2", 0xFF, 0x00, 0x00);
irr_driver->setPhase(1);
m_renderpass = scene::ESNRP_CAMERA | scene::ESNRP_SOLID;
glStencilFunc(GL_EQUAL, 0, ~0);
@@ -295,12 +301,16 @@ void IrrDriver::renderGLSL(float dt)
}
// 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;
PROFILER_PUSH_CPU_MARKER("- TransparentPass", 0xFF, 0x00, 0x00);
m_renderpass = scene::ESNRP_CAMERA | scene::ESNRP_TRANSPARENT;
m_scene_manager->drawAll(m_renderpass);
PROFILER_POP_CPU_MARKER();
PROFILER_PUSH_CPU_MARKER("- Particles", 0xFF, 0x00, 0x00);
m_renderpass = scene::ESNRP_CAMERA | 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();

View File

@@ -17,6 +17,7 @@
#include "profiler.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/glwrap.hpp"
#include "guiengine/event_handler.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/scalable_font.hpp"
@@ -231,7 +232,7 @@ void Profiler::draw()
pos.UpperLeftCorner.Y += m.layer;
pos.LowerRightCorner.Y -= m.layer;
driver->draw2DRectangle(m.color, pos);
GL32_draw2DRectangle(m.color, pos);
// If the mouse cursor is over the marker, get its information
if(pos.isPointInside(mouse_pos))
@@ -314,5 +315,5 @@ void Profiler::drawBackground()
(int)((MARGIN_Y + 3.0f*LINE_HEIGHT) * screen_size.Height));
video::SColor color(0xFF, 0xFF, 0xFF, 0xFF);
driver->draw2DRectangle(color, background_rect);
GL32_draw2DRectangle(color, background_rect);
}