From c705ad773266a0239af9949c63961d78415a6b1c Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 30 May 2014 10:54:08 +1000 Subject: [PATCH 1/8] Combined windows and non-windows handling of redirecting log to file (no idea why there was ever made a distinction). --- src/io/file_manager.cpp | 3 --- src/main.cpp | 5 ----- 2 files changed, 8 deletions(-) diff --git a/src/io/file_manager.cpp b/src/io/file_manager.cpp index a46b7f9d1..0de0e621c 100644 --- a/src/io/file_manager.cpp +++ b/src/io/file_manager.cpp @@ -195,11 +195,8 @@ FileManager::FileManager() checkAndCreateCachedTexturesDir(); checkAndCreateGPDir(); -#ifdef WIN32 redirectOutput(); -#endif - // We can't use _() here, since translations will only be initalised // after the filemanager (to get the path to the tranlsations from it) for(unsigned int i=0; iredirectOutput(); -#endif - input_manager = new InputManager (); #ifdef ENABLE_WIIUSE From 23e56e94547eceed4f8d1e06cdc868c27ff592a0 Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 30 May 2014 11:03:32 +1000 Subject: [PATCH 2/8] Fixed indentation. --- src/tracks/track.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 132e8c970..e283d9cc1 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -181,7 +181,7 @@ core::stringw Track::getName() const { translated = translated.subString(0, index); } - return translated; + return translated; } // getName //----------------------------------------------------------------------------- From a907df37ade48d0932633a548eade9e111c507ae Mon Sep 17 00:00:00 2001 From: hiker Date: Fri, 30 May 2014 16:00:28 +1000 Subject: [PATCH 3/8] Save the last three stdout.log files (which is useful in diagnosing crashes caused by e.g. a problem in a previous run). --- src/io/file_manager.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/src/io/file_manager.cpp b/src/io/file_manager.cpp index 0de0e621c..a4a013eb1 100644 --- a/src/io/file_manager.cpp +++ b/src/io/file_manager.cpp @@ -996,12 +996,36 @@ std::string FileManager::checkAndCreateLinuxDir(const char *env_name, //----------------------------------------------------------------------------- /** Redirects output to go into files in the user's config directory - * instead of to the console. + * instead of to the console. It keeps backup copies of previous stdout files + * (3 atm), which can help to diagnose problems caused by a previous crash. */ void FileManager::redirectOutput() { - //Enable logging of stdout and stderr to logfile + // Do a simple log rotate: stdout.log.2 becomes stdout.log.3 etc + const int NUM_BACKUPS=3; std::string logoutfile = getUserConfigFile("stdout.log"); + for(int i=NUM_BACKUPS; i>1; i--) + { + std::ostringstream out_old; + out_old << logoutfile << "." << i; + removeFile(out_old.str()); + std::ostringstream out_new; + out_new << logoutfile << "." << i-1; + if(fileExists(out_new.str())) + { + rename(out_new.str().c_str(), out_old.str().c_str()); + } + } // for i in NUM_BACKUPS + + if(fileExists(logoutfile)) + { + std::ostringstream out; + out << logoutfile<<".1"; + // No good place to log error messages when log is not yet initialised + rename(logoutfile.c_str(), out.str().c_str()); + } + + //Enable logging of stdout and stderr to logfile Log::verbose("main", "Error messages and other text output will " "be logged to %s.", logoutfile.c_str()); Log::openOutputFiles(logoutfile); From aa0691015ad8e1c2ab8a934b2d0ace06a80d3504 Mon Sep 17 00:00:00 2001 From: vlj Date: Fri, 30 May 2014 15:34:24 +0200 Subject: [PATCH 4/8] Fix crash with 3.1 context when cleaning rtt. --- src/graphics/rtts.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/graphics/rtts.cpp b/src/graphics/rtts.cpp index 73e9af4b1..32a9d5f96 100644 --- a/src/graphics/rtts.cpp +++ b/src/graphics/rtts.cpp @@ -55,6 +55,7 @@ RTT::RTT(size_t width, size_t height) { m_shadow_FBO = NULL; m_RSM = NULL; + m_RH_FBO = NULL; using namespace video; using namespace core; @@ -237,9 +238,6 @@ RTT::RTT(size_t width, size_t height) RTT::~RTT() { - delete m_shadow_FBO; - delete m_RH_FBO; - delete m_RSM; glDeleteTextures(RTT_COUNT, RenderTargetTextures); glDeleteTextures(1, &DepthStencilTexture); if (irr_driver->getGLSLVersion() >= 150) @@ -252,5 +250,9 @@ RTT::~RTT() glDeleteTextures(1, &RH_Red); glDeleteTextures(1, &RH_Green); glDeleteTextures(1, &RH_Blue); + + delete m_shadow_FBO; + delete m_RH_FBO; + delete m_RSM; } } From 5e132f741090c717841840db1eac81c6594bdf20 Mon Sep 17 00:00:00 2001 From: Marianne Gagnon Date: Fri, 30 May 2014 19:49:21 -0400 Subject: [PATCH 5/8] Add GI to video options --- data/gui/custom_video_settings.stkgui | 17 +++++++++-- .../dialogs/custom_video_settings.cpp | 4 +++ src/states_screens/options_screen_video.cpp | 28 +++++++++++++++---- 3 files changed, 40 insertions(+), 9 deletions(-) diff --git a/data/gui/custom_video_settings.stkgui b/data/gui/custom_video_settings.stkgui index 6229cbe73..2a5a4ecee 100644 --- a/data/gui/custom_video_settings.stkgui +++ b/data/gui/custom_video_settings.stkgui @@ -55,9 +55,20 @@
- - -
diff --git a/src/states_screens/dialogs/custom_video_settings.cpp b/src/states_screens/dialogs/custom_video_settings.cpp index 7579f11d8..f5c270d7c 100644 --- a/src/states_screens/dialogs/custom_video_settings.cpp +++ b/src/states_screens/dialogs/custom_video_settings.cpp @@ -87,6 +87,7 @@ void CustomVideoSettingsDialog::beforeAddingWidgets() getWidget("dynamiclight")->setState(UserConfigParams::m_dynamic_lights); getWidget("lightshaft")->setState(UserConfigParams::m_light_shaft); + getWidget("global_illumination")->setState(UserConfigParams::m_gi); getWidget("motionblur")->setState(UserConfigParams::m_motionblur); getWidget("mlaa")->setState(UserConfigParams::m_mlaa); getWidget("glow")->setState(UserConfigParams::m_glow); @@ -139,6 +140,9 @@ GUIEngine::EventPropagation CustomVideoSettingsDialog::processEvent(const std::s UserConfigParams::m_light_shaft = getWidget("lightshaft")->getState(); + UserConfigParams::m_gi = + getWidget("global_illumination")->getState(); + UserConfigParams::m_glow = getWidget("glow")->getState(); diff --git a/src/states_screens/options_screen_video.cpp b/src/states_screens/options_screen_video.cpp index 0a268f849..5c6a16a4c 100644 --- a/src/states_screens/options_screen_video.cpp +++ b/src/states_screens/options_screen_video.cpp @@ -61,6 +61,7 @@ struct GFXPreset int anisotropy; /** Depth of field */ bool dof; + bool global_illumination; }; static GFXPreset GFX_PRESETS[] = @@ -68,31 +69,36 @@ static GFXPreset GFX_PRESETS[] = { false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */, false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */, - false /* animatedScenery */, 0 /* animatedCharacters */, 0 /* anisotropy */, false /* depth of field */ + false /* animatedScenery */, 0 /* animatedCharacters */, 0 /* anisotropy */, + false /* depth of field */, false /* global illumination */ }, { false /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */, false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, false /* weather */, - true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */, false /* depth of field */ + true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */, + false /* depth of field */, false /* global illumination */ }, { true /* light */, 0 /* shadow */, false /* bloom */, false /* motionblur */, false /* lightshaft */, false /* glow */, false /* mlaa */, false /* ssao */, true /* weather */, - true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */, false /* depth of field */ + true /* animatedScenery */, 1 /* animatedCharacters */, 4 /* anisotropy */, + false /* depth of field */, false /* global illumination */ }, { true /* light */, 0 /* shadow */, false /* bloom */, true /* motionblur */, true /* lightshaft */, true /* glow */, true /* mlaa */, false /* ssao */, true /* weather */, - true /* animatedScenery */, 1 /* animatedCharacters */, 8 /* anisotropy */, false /* depth of field */ + true /* animatedScenery */, 1 /* animatedCharacters */, 8 /* anisotropy */, + false /* depth of field */, false /* global illumination */ }, { true /* light */, 2 /* shadow */, true /* bloom */, true /* motionblur */, true /* lightshaft */, true /* glow */, true /* mlaa */, true /* ssao */, true /* weather */, - true /* animatedScenery */, 2 /* animatedCharacters */, 8 /* anisotropy */, true /* depth of field */ + true /* animatedScenery */, 2 /* animatedCharacters */, 8 /* anisotropy */, + true /* depth of field */, true /* global illumination */ } }; @@ -362,7 +368,8 @@ void OptionsScreenVideo::updateGfxSlider() GFX_PRESETS[l].shadows == UserConfigParams::m_shadows && GFX_PRESETS[l].ssao == UserConfigParams::m_ssao && GFX_PRESETS[l].weather == UserConfigParams::m_weather_effects && - GFX_PRESETS[l].dof == UserConfigParams::m_dof) + GFX_PRESETS[l].dof == UserConfigParams::m_dof && + GFX_PRESETS[l].global_illumination == UserConfigParams::m_gi) { gfx->setValue(l + 1); found = true; @@ -444,6 +451,14 @@ void OptionsScreenVideo::updateTooltip() tooltip = tooltip + L"\n" + _("Light shaft (God rays) : %s", UserConfigParams::m_light_shaft ? enabled : disabled); + //I18N: in graphical options + tooltip = tooltip + L"\n" + _("Depth of field : %s", + UserConfigParams::m_dof ? enabled : disabled); + + //I18N: in graphical options + tooltip = tooltip + L"\n" + _("Global illumination : %s", + UserConfigParams::m_gi ? enabled : disabled); + gfx->setTooltip(tooltip); } // updateTooltip @@ -526,6 +541,7 @@ void OptionsScreenVideo::eventCallback(Widget* widget, const std::string& name, UserConfigParams::m_ssao = GFX_PRESETS[level].ssao; UserConfigParams::m_weather_effects = GFX_PRESETS[level].weather; UserConfigParams::m_dof = GFX_PRESETS[level].dof; + UserConfigParams::m_gi = GFX_PRESETS[level].global_illumination; updateGfxSlider(); } From 2d921ca5884608f44e308dbad490667a792ec603 Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 31 May 2014 01:52:10 +0200 Subject: [PATCH 6/8] Add a profiler for Dof --- src/graphics/irr_driver.hpp | 1 + src/graphics/post_processing.cpp | 3 +++ src/utils/profiler.cpp | 1 + 3 files changed, 5 insertions(+) diff --git a/src/graphics/irr_driver.hpp b/src/graphics/irr_driver.hpp index 29d9c5fef..f77040bd3 100644 --- a/src/graphics/irr_driver.hpp +++ b/src/graphics/irr_driver.hpp @@ -114,6 +114,7 @@ enum QueryPerf Q_TRANSPARENT, Q_PARTICLES, Q_DISPLACEMENT, + Q_DOF, Q_GODRAYS, Q_BLOOM, Q_TONEMAP, diff --git a/src/graphics/post_processing.cpp b/src/graphics/post_processing.cpp index 4c83781d9..88d965552 100644 --- a/src/graphics/post_processing.cpp +++ b/src/graphics/post_processing.cpp @@ -718,8 +718,11 @@ FrameBuffer *PostProcessing::render(scene::ICameraSceneNode * const camnode) if (UserConfigParams::m_dof) { + PROFILER_PUSH_CPU_MARKER("- DoF", 0xFF, 0x00, 0x00); + ScopedGPUTimer Timer(irr_driver->getGPUTimer(Q_DOF)); renderDoF(*out_fbo, in_fbo->getRTT()[0]); std::swap(in_fbo, out_fbo); + PROFILER_POP_CPU_MARKER(); } { diff --git a/src/utils/profiler.cpp b/src/utils/profiler.cpp index 4aed71068..1c272be4f 100644 --- a/src/utils/profiler.cpp +++ b/src/utils/profiler.cpp @@ -399,6 +399,7 @@ void Profiler::draw() "Transparent", "Particles", "Displacement", + "Depth of Field", "Godrays", "Bloom", "Tonemap", From 0f833b0619e16cddc6ef055adfdc90f74a86cb05 Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 31 May 2014 01:59:33 +0200 Subject: [PATCH 7/8] Remove unneeded shaders/wrong assignements. --- src/graphics/shaders.cpp | 27 --------------------------- src/graphics/shaders.hpp | 33 --------------------------------- 2 files changed, 60 deletions(-) diff --git a/src/graphics/shaders.cpp b/src/graphics/shaders.cpp index fb0ce46d9..824dd74b1 100644 --- a/src/graphics/shaders.cpp +++ b/src/graphics/shaders.cpp @@ -1510,8 +1510,6 @@ namespace MeshShader attrib_normal = glGetAttribLocation(Program, "Normal"); uniform_tex = glGetUniformLocation(Program, "tex"); uniform_RSMMatrix = glGetUniformLocation(Program, "RSMMatrix"); - GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData"); - glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0); } void RSMShader::setUniforms(const core::matrix4 &RSMMatrix, const core::matrix4 &ModelMatrix, unsigned TU_tex) @@ -2339,8 +2337,6 @@ namespace FullScreenShader uniform_RHMatrix = glGetUniformLocation(Program, "RHMatrix"); uniform_RSMMatrix = glGetUniformLocation(Program, "RSMMatrix"); vao = createVAO(Program); - GLuint uniform_ViewProjectionMatrixesUBO = glGetUniformBlockIndex(Program, "MatrixesData"); - glUniformBlockBinding(Program, uniform_ViewProjectionMatrixesUBO, 0); } void RadianceHintsConstructionShader::setUniforms(const core::matrix4 &RSMMatrix, const core::matrix4 &RHMatrix, const core::vector3df &extents, unsigned TU_ctex, unsigned TU_ntex, unsigned TU_dtex) @@ -2507,29 +2503,6 @@ namespace FullScreenShader vao = createVAO(Program); } - GLuint ShadowGenShader::Program; - GLuint ShadowGenShader::uniform_halft; - GLuint ShadowGenShader::uniform_quarter; - GLuint ShadowGenShader::uniform_height; - GLuint ShadowGenShader::vao; - void ShadowGenShader::init() - { - Program = LoadProgram( - GL_VERTEX_SHADER, file_manager->getAsset("shaders/screenquad.vert").c_str(), - GL_FRAGMENT_SHADER, file_manager->getAsset("shaders/shadowgen.frag").c_str()); - uniform_halft = glGetUniformLocation(Program, "halft"); - uniform_quarter = glGetUniformLocation(Program, "quarter"); - uniform_height = glGetUniformLocation(Program, "height"); - vao = createVAO(Program); - } - - void ShadowGenShader::setUniforms(GLuint TU_halft, GLuint TU_quarter, GLuint TU_height) - { - glUniform1i(uniform_halft, TU_halft); - glUniform1i(uniform_quarter, TU_quarter); - glUniform1i(uniform_height, TU_height); - } - GLuint PassThroughShader::Program; GLuint PassThroughShader::uniform_texture; GLuint PassThroughShader::vao; diff --git a/src/graphics/shaders.hpp b/src/graphics/shaders.hpp index 6073b4d7d..328ab07f7 100644 --- a/src/graphics/shaders.hpp +++ b/src/graphics/shaders.hpp @@ -701,39 +701,6 @@ public: static void init(); }; -class PenumbraHShader -{ -public: - static GLuint Program; - static GLuint uniform_tex, uniform_pixel; - static GLuint vao; - - static void init(); - static void setUniforms(const core::vector2df &pixels, GLuint TU_tex); -}; - -class PenumbraVShader -{ -public: - static GLuint Program; - static GLuint uniform_tex, uniform_pixel; - static GLuint vao; - - static void init(); - static void setUniforms(const core::vector2df &pixels, GLuint TU_tex); -}; - -class ShadowGenShader -{ -public: - static GLuint Program; - static GLuint uniform_halft, uniform_quarter, uniform_height; - static GLuint vao; - - static void init(); - static void setUniforms(GLuint TU_halft, GLuint TU_quarter, GLuint TU_height); -}; - class PassThroughShader { public: From 6643f749b1a4a6705a022f7b62c472ae7fcfc127 Mon Sep 17 00:00:00 2001 From: vlj Date: Sat, 31 May 2014 02:04:32 +0200 Subject: [PATCH 8/8] Remove unneeded profilers. --- src/graphics/stkanimatedmesh.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/graphics/stkanimatedmesh.cpp b/src/graphics/stkanimatedmesh.cpp index ab3011188..f5fa307c5 100644 --- a/src/graphics/stkanimatedmesh.cpp +++ b/src/graphics/stkanimatedmesh.cpp @@ -150,8 +150,6 @@ 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]) { @@ -167,14 +165,11 @@ void STKAnimatedMesh::render() GroupedFPSM::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); @@ -221,7 +216,6 @@ void STKAnimatedMesh::render() GroupedSM::TIMVSet.push_back(invmodel); } - PROFILER_POP_CPU_MARKER(); return; }