misc little changes

This commit is contained in:
Marianne Gagnon 2014-04-13 14:25:10 -04:00
parent f98ff2a5fc
commit 99a50ec70c
4 changed files with 17 additions and 8 deletions

View File

@ -6,6 +6,7 @@
#include "config/user_config.hpp"
#include "modes/world.hpp"
#include "tracks/track.hpp"
#include "utils/profiler.hpp"
using namespace irr;
@ -148,6 +149,8 @@ void STKAnimatedMesh::render()
core::matrix4 invmodel;
AbsoluteTransformation.getInverse(invmodel);
PROFILER_PUSH_CPU_MARKER("GATHER SOLID MESHES", 0xFC, 0xFA, 0x68);
GLMesh* mesh;
for_in(mesh, GeometricMesh[FPSM_DEFAULT])
{
@ -163,11 +166,14 @@ void STKAnimatedMesh::render()
GroupedFPSM<FPSM_ALPHA_REF_TEXTURE>::TIMVSet.push_back(invmodel);
}
PROFILER_POP_CPU_MARKER();
return;
}
if (irr_driver->getPhase() == SOLID_LIT_PASS)
{
PROFILER_PUSH_CPU_MARKER("GATHER TRANSPARENT MESHES", 0xFC, 0xFA, 0x68);
core::matrix4 invmodel;
AbsoluteTransformation.getInverse(invmodel);
@ -214,6 +220,7 @@ void STKAnimatedMesh::render()
GroupedSM<SM_UNTEXTURED>::TIMVSet.push_back(invmodel);
}
PROFILER_POP_CPU_MARKER();
return;
}

View File

@ -615,7 +615,7 @@ TrackObjectPresentationParticles::TrackObjectPresentationParticles(const XMLNode
}
catch (std::runtime_error& e)
{
fprintf(stderr, "[Track] WARNING: Could not load particles '%s'; cause :\n %s", path.c_str(), e.what());
Log::warn ("Track", "Could not load particles '%s'; cause :\n %s", path.c_str(), e.what());
}
}

View File

@ -44,7 +44,7 @@ Profiler profiler;
#ifdef WIN32
#include <windows.h>
static double _getTimeMilliseconds()
double getTimeMilliseconds()
{
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
@ -57,7 +57,7 @@ Profiler profiler;
#else
#include <sys/time.h>
static double _getTimeMilliseconds()
double getTimeMilliseconds()
{
struct timeval tv;
gettimeofday(&tv, NULL);
@ -71,7 +71,7 @@ Profiler::Profiler()
{
m_thread_infos.resize(1); // TODO: monothread now, should support multithreading
m_write_id = 0;
m_time_last_sync = _getTimeMilliseconds();
m_time_last_sync = getTimeMilliseconds();
m_time_between_sync = 0.0;
m_freeze_state = UNFROZEN;
m_capture_report = false;
@ -120,7 +120,7 @@ void Profiler::pushCpuMarker(const char* name, const video::SColor& color)
ThreadInfo& ti = getThreadInfo();
MarkerStack& markers_stack = ti.markers_stack[m_write_id];
double start = _getTimeMilliseconds() - m_time_last_sync;
double start = getTimeMilliseconds() - m_time_last_sync;
size_t layer = markers_stack.size();
// Add to the stack of current markers
@ -143,7 +143,7 @@ void Profiler::popCpuMarker()
// Update the date of end of the marker
Marker& marker = markers_stack.top();
marker.end = _getTimeMilliseconds() - m_time_last_sync;
marker.end = getTimeMilliseconds() - m_time_last_sync;
// Remove the marker from the stack and add it to the list of markers done
markers_done.push_front(marker);
@ -158,8 +158,8 @@ void Profiler::synchronizeFrame()
if(m_freeze_state == FROZEN)
return;
// Avoid using several times _getTimeMilliseconds(), which would yield different results
double now = _getTimeMilliseconds();
// Avoid using several times getTimeMilliseconds(), which would yield different results
double now = getTimeMilliseconds();
// Swap buffers
int old_write_id = m_write_id;

View File

@ -31,6 +31,8 @@
class Profiler;
extern Profiler profiler;
double getTimeMilliseconds();
#define ENABLE_PROFILER
#ifdef ENABLE_PROFILER