diff --git a/src/cache.h b/src/cache.h index 203e2a5..820bd01 100644 --- a/src/cache.h +++ b/src/cache.h @@ -593,6 +593,8 @@ struct WaterCache { } void renderMask() { + if (!visible) return; + PROFILE_MARKER("WATER_RENDER_MASK"); // mask underwater geometry by zero alpha game->setShader(Core::passWater, Shader::WATER_MASK); Core::active.shader->setParam(uTexParam, vec4(1.0f)); @@ -626,6 +628,8 @@ struct WaterCache { } void getRefract() { + if (!visible) return; + PROFILE_MARKER("WATER_REFRACT"); int w, h; getTargetSize(w, h); // get refraction texture @@ -637,6 +641,7 @@ struct WaterCache { } void simulate() { + PROFILE_MARKER("WATER_SIMULATE"); // simulate water Core::setDepthTest(false); Core::setBlending(bmNone); @@ -657,6 +662,7 @@ struct WaterCache { void renderReflect() { if (!visible) return; + PROFILE_MARKER("WATER_REFLECT"); for (int i = 0; i < count; i++) { Item &item = items[i]; @@ -698,6 +704,8 @@ struct WaterCache { } void render() { + if (!visible) return; + PROFILE_MARKER("WATER_RENDER"); for (int i = 0; i < count; i++) { Item &item = items[i]; if (!item.visible) continue; diff --git a/src/core.h b/src/core.h index d1f3dca..1440367 100644 --- a/src/core.h +++ b/src/core.h @@ -288,13 +288,41 @@ namespace Core { } #ifdef PROFILE + #define USE_CV_MARKERS + + #ifdef USE_CV_MARKERS + #include + using namespace Concurrency::diagnostic; + + marker_series *series[256]; + int seriesIndex; + #endif + struct Marker { + #ifdef USE_CV_MARKERS + span *cvSpan; + #endif + Marker(const char *title) { if (Core::support.profMarker) glPushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 1, -1, title); + #ifdef USE_CV_MARKERS + marker_series *&s = series[seriesIndex]; + if (s == NULL) { + char seriesTitle[64]; + sprintf(seriesTitle, "events - %d", seriesIndex); + s = new marker_series(seriesTitle); + } + cvSpan = new span(*s, normal_importance, _T(title)); + seriesIndex++; + #endif } ~Marker() { if (Core::support.profMarker) glPopDebugGroup(); + #ifdef USE_CV_MARKERS + delete cvSpan; + seriesIndex--; + #endif } static void setLabel(GLenum id, GLuint name, const char *label) { diff --git a/src/game.h b/src/game.h index 6e5fc5e..080c626 100644 --- a/src/game.h +++ b/src/game.h @@ -67,6 +67,7 @@ namespace Game { } void update(float delta) { + PROFILE_MARKER("UPDATE"); Input::update(); if (Input::down[ikV]) { // third <-> first person view @@ -85,6 +86,7 @@ namespace Game { } void render() { + PROFILE_MARKER("RENDER"); PROFILE_TIMING(Core::stats.tFrame); Core::beginFrame(); level->render(); diff --git a/src/platform/win/main.cpp b/src/platform/win/main.cpp index f60d9e5..af7e375 100644 --- a/src/platform/win/main.cpp +++ b/src/platform/win/main.cpp @@ -372,8 +372,8 @@ int main(int argc, char** argv) { joyUpdate(); DWORD time = getTime(); - if (time <= lastTime) - continue; + //if (time <= lastTime) + // continue; EnterCriticalSection(&sndCS); Game::update((time - lastTime) * 0.001f);