From ce38df268b01772c8d37fd680191114249fd7e8f Mon Sep 17 00:00:00 2001 From: Rob Clark Date: Fri, 22 Jul 2016 20:29:42 -0400 Subject: [PATCH 1/8] couple small performance optimizations (#2578) * pass timeout to driver, rather than unconditional 1ms sleep This way if the fence is signalled earlier, we can get on with life sooner. * optimize displacement bind/clear/render Stop thrashing render targets, and group things together into single render-passes. And only bind/clear if we will actually draw. --- src/graphics/render_geometry.cpp | 17 ++++++++++------- src/graphics/stk_scene_manager.cpp | 3 +-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/graphics/render_geometry.cpp b/src/graphics/render_geometry.cpp index c0c758abb..522efafbc 100644 --- a/src/graphics/render_geometry.cpp +++ b/src/graphics/render_geometry.cpp @@ -1602,11 +1602,6 @@ void IrrDriver::renderTransparent() return; // Render displacement nodes - irr_driver->getFBO(FBO_TMP1_WITH_DS).bind(); - glClear(GL_COLOR_BUFFER_BIT); - irr_driver->getFBO(FBO_DISPLACE).bind(); - glClear(GL_COLOR_BUFFER_BIT); - DisplaceProvider * const cb = (DisplaceProvider *)Shaders::getCallback(ES_DISPLACE); cb->update(); @@ -1623,7 +1618,11 @@ void IrrDriver::renderTransparent() glBindVertexArray(VAOManager::getInstance()->getVAO(video::EVT_2TCOORDS)); // Generate displace mask // Use RTT_TMP4 as displace mask - irr_driver->getFBO(FBO_TMP1_WITH_DS).bind(); + if (ListDisplacement::getInstance()->size() > 0) + { + irr_driver->getFBO(FBO_TMP1_WITH_DS).bind(); + glClear(GL_COLOR_BUFFER_BIT); + } for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++) { const GLMesh &mesh = @@ -1650,7 +1649,11 @@ void IrrDriver::renderTransparent() (GLvoid *)mesh.vaoOffset, (int)mesh.vaoBaseVertex); } - irr_driver->getFBO(FBO_DISPLACE).bind(); + if (ListDisplacement::getInstance()->size() > 0) + { + irr_driver->getFBO(FBO_DISPLACE).bind(); + glClear(GL_COLOR_BUFFER_BIT); + } if (!displaceTex) displaceTex = irr_driver->getTexture(FileManager::TEXTURE, "displace.png"); for (unsigned i = 0; i < ListDisplacement::getInstance()->size(); i++) diff --git a/src/graphics/stk_scene_manager.cpp b/src/graphics/stk_scene_manager.cpp index cc5c5ac1b..6f09a0269 100644 --- a/src/graphics/stk_scene_manager.cpp +++ b/src/graphics/stk_scene_manager.cpp @@ -657,8 +657,7 @@ PROFILER_POP_CPU_MARKER(); while (reason != GL_ALREADY_SIGNALED) { if (reason == GL_WAIT_FAILED) break; - StkTime::sleep(1); - reason = glClientWaitSync(m_sync, GL_SYNC_FLUSH_COMMANDS_BIT, 0); + reason = glClientWaitSync(m_sync, GL_SYNC_FLUSH_COMMANDS_BIT, 1000000); } glDeleteSync(m_sync); PROFILER_POP_CPU_MARKER(); From 5b4d8e1f8ac0490c5e927d53e2a8339280df38a4 Mon Sep 17 00:00:00 2001 From: Benau Date: Sat, 23 Jul 2016 10:48:48 +0800 Subject: [PATCH 2/8] Remove old font settings --- src/config/stk_config.cpp | 11 ----------- src/config/stk_config.hpp | 8 -------- 2 files changed, 19 deletions(-) diff --git a/src/config/stk_config.cpp b/src/config/stk_config.cpp index 288fef4c8..f8d11f74a 100644 --- a/src/config/stk_config.cpp +++ b/src/config/stk_config.cpp @@ -354,17 +354,6 @@ void STKConfig::getAllData(const XMLNode * root) } - if(const XMLNode *font_node = root->getNode("font")) - { - font_node->get("default", &m_font_default ); - font_node->get("default_fallback", &m_font_default_fallback); - font_node->get("cjk", &m_font_cjk ); - font_node->get("ar", &m_font_ar ); - font_node->get("bold", &m_font_bold ); - font_node->get("bold_fallback", &m_font_bold_fallback ); - font_node->get("digit", &m_font_digit ); - } - if (const XMLNode *fonts_list = root->getNode("fonts-list")) { fonts_list->get("normal-ttf", &m_normal_ttf); diff --git a/src/config/stk_config.hpp b/src/config/stk_config.hpp index 21a8c678a..314144c55 100644 --- a/src/config/stk_config.hpp +++ b/src/config/stk_config.hpp @@ -145,14 +145,6 @@ public: float m_cutscene_fov; - /** File names of the default fonts in STK. */ - std::string m_font_default; - std::string m_font_default_fallback; - std::string m_font_cjk; - std::string m_font_ar; - std::string m_font_bold; - std::string m_font_bold_fallback; - std::string m_font_digit; /** Lists of TTF files used in STK. */ std::vector m_normal_ttf; std::vector m_digit_ttf; From 9cbf8a06416ada37da63c91472c758ce4f2d19a2 Mon Sep 17 00:00:00 2001 From: qwertychouskie Date: Sat, 23 Jul 2016 14:16:09 -0700 Subject: [PATCH 3/8] Update link --- data/supertuxkart.appdata.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/supertuxkart.appdata.xml b/data/supertuxkart.appdata.xml index bed5375cb..412961b51 100644 --- a/data/supertuxkart.appdata.xml +++ b/data/supertuxkart.appdata.xml @@ -25,7 +25,7 @@ against the computer or your friends, and more!

- http://supertuxkart.sourceforge.net/ + http://supertuxkart.net/ http://supertuxkart.sourceforge.net/persistent/images/4/4e/Supertuxkart-0.9-screenshot-2.jpg http://supertuxkart.sourceforge.net/persistent/images/a/a9/Supertuxkart-0.9-screenshot-1.jpg From 493030ba9caf3594e204844ab77b25eee7f6d5b9 Mon Sep 17 00:00:00 2001 From: qwertychouskie Date: Sat, 23 Jul 2016 14:17:30 -0700 Subject: [PATCH 4/8] Update link --- doc/conventions.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/conventions.txt b/doc/conventions.txt index 1926e07d7..11f79b04d 100644 --- a/doc/conventions.txt +++ b/doc/conventions.txt @@ -12,7 +12,7 @@ Coding style ============ The coding style used in Super Tux Kart can be found at -http://supertuxkart.sourceforge.net/Coding_Style +http://supertuxkart.net/Coding_Style Documentation line length From 94440645a0f874c66d22af7014226662a37247e8 Mon Sep 17 00:00:00 2001 From: qwertychouskie Date: Sat, 23 Jul 2016 14:22:03 -0700 Subject: [PATCH 5/8] Update link --- tools/build-linux-travis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/build-linux-travis.sh b/tools/build-linux-travis.sh index 94d1ee305..741eb636e 100755 --- a/tools/build-linux-travis.sh +++ b/tools/build-linux-travis.sh @@ -1,7 +1,7 @@ #!/bin/sh # # Automate the build process on Linux based on -# http://supertuxkart.sourceforge.net/Build_STK_on_Linux +# http://supertuxkart.net/Build_STK_on_Linux # CMake build type BUILDTYPE=Debug From 42b80d5e9c47bbf822955871d7930c339d94089f Mon Sep 17 00:00:00 2001 From: qwertychouskie Date: Sat, 23 Jul 2016 14:23:36 -0700 Subject: [PATCH 6/8] Update link --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index d8958f1c2..2ee725eb8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -591,7 +591,7 @@ void cmdLineHelp() " --shadows=n Set shadow quality (0 to disable shadows).\n" "\n" "You can visit SuperTuxKart's homepage at " - "http://supertuxkart.sourceforge.net\n\n", + "http://supertuxkart.net\n\n", CommandLine::getExecName().c_str() ); } // cmdLineHelp From 236c9c44a8b989d95ef3be46040af3ce0a7db2d4 Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 24 Jul 2016 09:56:46 +0800 Subject: [PATCH 7/8] Minor improvements for font --- src/font/font_with_face.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/font/font_with_face.cpp b/src/font/font_with_face.cpp index 579169131..a5eedeef6 100644 --- a/src/font/font_with_face.cpp +++ b/src/font/font_with_face.cpp @@ -145,10 +145,11 @@ void FontWithFace::insertGlyph(wchar_t c, const GlyphInfo& gi) font_manager->checkFTError(FT_Load_Glyph(cur_face, gi.glyph_index, FT_LOAD_DEFAULT), "loading a glyph"); - if (dynamic_cast(this)) + if (dynamic_cast(this) != NULL) { // Embolden the outline of the glyph - FT_Outline_Embolden(&(slot->outline), getDPI() * 2); + font_manager->checkFTError(FT_Outline_Embolden(&(slot->outline), + getDPI() * 2), "embolden a glyph"); } font_manager->checkFTError(FT_Render_Glyph(slot, FT_RENDER_MODE_NORMAL), @@ -321,7 +322,7 @@ void FontWithFace::dumpGlyphPage() // ---------------------------------------------------------------------------- void FontWithFace::setDPI() { - // Get face dpi: + // Set face dpi: // Font size is resolution-dependent. // Normal text will range from 0.8, in 640x* resolutions (won't scale // below that) to 1.0, in 1024x* resolutions, and linearly up @@ -445,7 +446,7 @@ void FontWithFace::render(const core::stringw& text, FontSettings* font_settings, FontCharCollector* char_collector) { - const bool is_bold_face = dynamic_cast(this); + const bool is_bold_face = (dynamic_cast(this) != NULL); const bool black_border = font_settings ? font_settings->useBlackBorder() : false; const bool rtl = font_settings ? font_settings->isRTL() : false; @@ -513,7 +514,7 @@ void FontWithFace::render(const core::stringw& text, if (c==L'\r' && text[i+1]==L'\n') c = text[++i]; offset.Y += m_font_max_height * scale; - offset.X = position.UpperLeftCorner.X; + offset.X = float(position.UpperLeftCorner.X); if (hcenter) offset.X += (position.getWidth() - text_dimension.Width) >> 1; continue; From 6a4fe397d4487ee34315dbf07d7d37a7d11df9bb Mon Sep 17 00:00:00 2001 From: Benau Date: Sun, 24 Jul 2016 15:56:02 +0800 Subject: [PATCH 8/8] Thanks devnexen for spotting this out --- src/font/font_with_face.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/font/font_with_face.cpp b/src/font/font_with_face.cpp index a5eedeef6..0e1659ae0 100644 --- a/src/font/font_with_face.cpp +++ b/src/font/font_with_face.cpp @@ -26,7 +26,7 @@ #include "guiengine/skin.hpp" #include "utils/string_utils.hpp" -#include +#include FT_OUTLINE_H // ---------------------------------------------------------------------------- FontWithFace::FontWithFace(const std::string& name, FaceTTF* ttf)