Merge remote-tracking branch 'origin/master' into network_improvements
This commit is contained in:
commit
3223d05c6c
@ -1,16 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<stkgui>
|
||||
<div x="2%" y="10%" width="96%" height="70%" layout="vertical-row">
|
||||
<div id="kart-screen" layout="horizontal-row" width="100%" height="60%" proportion="10" align="center">
|
||||
<placeholder width="100%" layout="horizontal-row" height="100%">
|
||||
<!-- Content is added programmatically -->
|
||||
</placeholder>
|
||||
<div x="2%" y="0%" width="96%" height="95%" layout="vertical-row">
|
||||
<div id="kart-screen" layout="horizontal-row" width="100%" proportion="1" align="center">
|
||||
<model id="model" width="100%" layout="horizontal-row" height="100%">
|
||||
</model>
|
||||
</div>
|
||||
<label text="0 to use the original color, otherwise pick one from slider."
|
||||
width="100%" text_align="center" word_wrap="true"
|
||||
I18N="In the kart color slider dialog"/>
|
||||
<spacer height="30" width="10"/>
|
||||
<div proportion="1" width="100%" layout="horizontal-row">
|
||||
<div height="fit" width="100%" layout="horizontal-row">
|
||||
<gauge id="color-slider" min_value="0" max_value="100" proportion="1"/>
|
||||
</div>
|
||||
<spacer height="30" width="10"/>
|
||||
|
@ -2,7 +2,7 @@
|
||||
<stkgui>
|
||||
<div x="2%" y="10%" width="96%" height="80%" layout="vertical-row" >
|
||||
|
||||
<label id="title" width="100%" text_align="center" text="Press a key" proportion="1" />
|
||||
<label id="title" width="100%" text_align="center" text="Press fully and release..." proportion="1" I18N="When changing input configurations" word_wrap="true"/>
|
||||
|
||||
<spacer height="25" width="10" />
|
||||
|
||||
|
@ -63,6 +63,7 @@ CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
|
||||
Android->onAppCmd = handleAndroidCommand;
|
||||
Android->onInputEvent = handleInput;
|
||||
|
||||
printConfig();
|
||||
createKeyMap();
|
||||
|
||||
CursorControl = new CCursorControl();
|
||||
@ -117,6 +118,46 @@ CIrrDeviceAndroid::~CIrrDeviceAndroid()
|
||||
Android->onInputEvent = NULL;
|
||||
}
|
||||
|
||||
void CIrrDeviceAndroid::printConfig()
|
||||
{
|
||||
char language[3] = {};
|
||||
char country[3] = {};
|
||||
AConfiguration_getLanguage(Android->config, language);
|
||||
AConfiguration_getCountry(Android->config, country);
|
||||
int32_t mcc = AConfiguration_getMcc(Android->config);
|
||||
int32_t mnc = AConfiguration_getMnc(Android->config);
|
||||
int32_t orientation = AConfiguration_getOrientation(Android->config);
|
||||
int32_t touch = AConfiguration_getTouchscreen(Android->config);
|
||||
int32_t density = AConfiguration_getDensity(Android->config);
|
||||
int32_t keyboard = AConfiguration_getKeyboard(Android->config);
|
||||
int32_t navigation = AConfiguration_getNavigation(Android->config);
|
||||
int32_t keys_hidden = AConfiguration_getKeysHidden(Android->config);
|
||||
int32_t nav_hidden = AConfiguration_getNavHidden(Android->config);
|
||||
int32_t sdk_version = AConfiguration_getSdkVersion(Android->config);
|
||||
int32_t screen_size = AConfiguration_getScreenSize(Android->config);
|
||||
int32_t screen_long = AConfiguration_getScreenLong(Android->config);
|
||||
int32_t ui_mode_type = AConfiguration_getUiModeType(Android->config);
|
||||
int32_t ui_mode_night = AConfiguration_getUiModeNight(Android->config);
|
||||
|
||||
os::Printer::log("Android configuration: ", ELL_DEBUG);
|
||||
os::Printer::log(" country:", country != NULL ? country : "unknown", ELL_DEBUG);
|
||||
os::Printer::log(" density:", core::stringc(density).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" keyboard:", core::stringc(keyboard).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" keys_hidden:", core::stringc(keys_hidden).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" language:", language != NULL ? language : "unknown", ELL_DEBUG);
|
||||
os::Printer::log(" mcc:", core::stringc(mcc).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" mnc:", core::stringc(mnc).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" nav_hidden:", core::stringc(nav_hidden).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" navigation:", core::stringc(navigation).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" orientation:", core::stringc(orientation).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" screen_long:", core::stringc(screen_long).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" screen_size:", core::stringc(screen_size).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" sdk_version:", core::stringc(sdk_version).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" touch:", core::stringc(touch).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" ui_mode_type:", core::stringc(ui_mode_type).c_str(), ELL_DEBUG);
|
||||
os::Printer::log(" ui_mode_night:", core::stringc(ui_mode_night).c_str(), ELL_DEBUG);
|
||||
}
|
||||
|
||||
void CIrrDeviceAndroid::createVideoModeList()
|
||||
{
|
||||
if (VideoModeList.getVideoModeCount() > 0)
|
||||
|
@ -128,6 +128,7 @@ namespace irr
|
||||
|
||||
std::map<int, EKEY_CODE> KeyMap;
|
||||
|
||||
void printConfig();
|
||||
void createDriver();
|
||||
void createKeyMap();
|
||||
void createVideoModeList();
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "config/user_config.hpp"
|
||||
#include "modes/profile_world.hpp"
|
||||
#include "graphics/sp/sp_base.hpp"
|
||||
#include "graphics/gl_headers.hpp"
|
||||
#include "graphics/glwrap.hpp"
|
||||
#include "graphics/graphics_restrictions.hpp"
|
||||
@ -254,6 +255,14 @@ void CentralVideoSettings::init()
|
||||
UserConfigParams::m_max_texture_size = 256;
|
||||
}
|
||||
}
|
||||
#ifndef ANDROID
|
||||
if (SP::sp_apitrace)
|
||||
{
|
||||
Log::info("IrrDriver", "Writing GPU query strings to apitrace and"
|
||||
" disable buffer storage");
|
||||
hasBufferStorage = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include "graphics/central_settings.hpp"
|
||||
#include "graphics/irr_driver.hpp"
|
||||
#include "graphics/shaders.hpp"
|
||||
#include "graphics/sp/sp_base.hpp"
|
||||
#include "utils/profiler.hpp"
|
||||
#include "utils/cpp2011.hpp"
|
||||
#include "utils/string_utils.hpp"
|
||||
@ -156,6 +157,17 @@ debugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei le
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_GLES2
|
||||
GL_APICALL void(*GL_APIENTRY glDebugMessageControl)(GLenum source, GLenum type,
|
||||
GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
|
||||
GL_APICALL void(*GL_APIENTRY glDebugMessageInsert)(GLenum source, GLenum type,
|
||||
GLuint id, GLenum severity, GLsizei length, const char *message);
|
||||
|
||||
#define GL_DEBUG_SOURCE_APPLICATION 0x824A
|
||||
#define GL_DEBUG_TYPE_MARKER 0x8268
|
||||
#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
|
||||
#endif
|
||||
|
||||
void initGL()
|
||||
{
|
||||
if (is_gl_init)
|
||||
@ -187,10 +199,37 @@ void initGL()
|
||||
if (glDebugMessageCallbackARB)
|
||||
glDebugMessageCallbackARB((GLDEBUGPROCARB)debugCallback, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef ANDROID
|
||||
if (SP::sp_apitrace && hasGLExtension("GL_KHR_debug"))
|
||||
{
|
||||
#ifdef USE_GLES2
|
||||
glDebugMessageControl = (void(GL_APIENTRY*)(GLenum, GLenum, GLenum, GLsizei,
|
||||
const GLuint*, GLboolean))eglGetProcAddress("glDebugMessageControlKHR");
|
||||
glDebugMessageInsert = (void(GL_APIENTRY*)(GLenum, GLenum, GLuint, GLenum,
|
||||
GLsizei, const char*))eglGetProcAddress("glDebugMessageInsertKHR");
|
||||
assert(glDebugMessageControl && glDebugMessageInsert);
|
||||
#endif
|
||||
glDebugMessageControl(GL_DONT_CARE, GL_DONT_CARE, GL_DONT_CARE, 0, NULL, GL_TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
SP::sp_apitrace = false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ScopedGPUTimer::ScopedGPUTimer(GPUTimer &t) : timer(t)
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (SP::sp_apitrace)
|
||||
{
|
||||
std::string msg = timer.getName();
|
||||
msg += " begin";
|
||||
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 100,
|
||||
GL_DEBUG_SEVERITY_NOTIFICATION, -1, msg.c_str());
|
||||
}
|
||||
#endif
|
||||
if (!UserConfigParams::m_profiler_enabled) return;
|
||||
if (profiler.isFrozen()) return;
|
||||
if (!timer.canSubmitQuery) return;
|
||||
@ -205,6 +244,15 @@ ScopedGPUTimer::ScopedGPUTimer(GPUTimer &t) : timer(t)
|
||||
}
|
||||
ScopedGPUTimer::~ScopedGPUTimer()
|
||||
{
|
||||
#ifndef ANDROID
|
||||
if (SP::sp_apitrace)
|
||||
{
|
||||
std::string msg = timer.getName();
|
||||
msg += " end";
|
||||
glDebugMessageInsert(GL_DEBUG_SOURCE_APPLICATION, GL_DEBUG_TYPE_MARKER, 100,
|
||||
GL_DEBUG_SEVERITY_NOTIFICATION, -1, msg.c_str());
|
||||
}
|
||||
#endif
|
||||
if (!UserConfigParams::m_profiler_enabled) return;
|
||||
if (profiler.isFrozen()) return;
|
||||
if (!timer.canSubmitQuery) return;
|
||||
@ -214,8 +262,10 @@ ScopedGPUTimer::~ScopedGPUTimer()
|
||||
#endif
|
||||
}
|
||||
|
||||
GPUTimer::GPUTimer() : initialised(false), lastResult(0), canSubmitQuery(true)
|
||||
GPUTimer::GPUTimer(const char* name)
|
||||
: m_name(name)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
unsigned GPUTimer::elapsedTimeus()
|
||||
|
@ -56,9 +56,17 @@ class GPUTimer
|
||||
bool initialised;
|
||||
unsigned lastResult;
|
||||
bool canSubmitQuery;
|
||||
const char* m_name;
|
||||
public:
|
||||
GPUTimer();
|
||||
GPUTimer(const char* name);
|
||||
unsigned elapsedTimeus();
|
||||
const char* getName() const { return m_name; }
|
||||
void reset()
|
||||
{
|
||||
initialised = false;
|
||||
lastResult = 0;
|
||||
canSubmitQuery = true;
|
||||
}
|
||||
};
|
||||
|
||||
class VertexUtils
|
||||
|
@ -98,7 +98,33 @@ using namespace irr;
|
||||
IrrDriver *irr_driver = NULL;
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
GPUTimer m_perf_query[Q_LAST];
|
||||
GPUTimer* m_perf_query[Q_LAST];
|
||||
static const char* m_perf_query_phase[Q_LAST] =
|
||||
{
|
||||
"Shadows Cascade 0",
|
||||
"Shadows Cascade 1",
|
||||
"Shadows Cascade 2",
|
||||
"Shadows Cascade 3",
|
||||
"Solid Pass",
|
||||
"Env Map",
|
||||
"SunLight",
|
||||
"PointLights",
|
||||
"SSAO",
|
||||
"Light Scatter",
|
||||
"Glow",
|
||||
"Combine Diffuse Color",
|
||||
"Skybox",
|
||||
"Transparent",
|
||||
"Particles",
|
||||
"Depth of Field",
|
||||
"Godrays",
|
||||
"Bloom",
|
||||
"Tonemap",
|
||||
"Motion Blur",
|
||||
"Lightning",
|
||||
"MLAA",
|
||||
"GUI",
|
||||
};
|
||||
#endif
|
||||
|
||||
const int MIN_SUPPORTED_HEIGHT = 768;
|
||||
@ -143,6 +169,12 @@ IrrDriver::IrrDriver()
|
||||
m_recording = false;
|
||||
m_sun_interposer = NULL;
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
for (unsigned i = 0; i < Q_LAST; i++)
|
||||
{
|
||||
m_perf_query[i] = new GPUTimer(m_perf_query_phase[i]);
|
||||
}
|
||||
#endif
|
||||
} // IrrDriver
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -156,12 +188,29 @@ IrrDriver::~IrrDriver()
|
||||
STKTexManager::getInstance()->kill();
|
||||
delete m_wind;
|
||||
delete m_renderer;
|
||||
#ifndef SERVER_ONLY
|
||||
for (unsigned i = 0; i < Q_LAST; i++)
|
||||
{
|
||||
delete m_perf_query[i];
|
||||
}
|
||||
#endif
|
||||
assert(m_device != NULL);
|
||||
m_device->drop();
|
||||
m_device = NULL;
|
||||
m_modes.clear();
|
||||
} // ~IrrDriver
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
const char* IrrDriver::getGPUQueryPhaseName(unsigned q)
|
||||
{
|
||||
#ifndef SERVER_ONLY
|
||||
assert(q < Q_LAST);
|
||||
return m_perf_query_phase[q];
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
} // getGPUQueryPhaseName
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Called before a race is started, after all cameras are set up.
|
||||
*/
|
||||
@ -184,7 +233,7 @@ core::array<video::IRenderTarget> &IrrDriver::getMainSetup()
|
||||
|
||||
GPUTimer &IrrDriver::getGPUTimer(unsigned i)
|
||||
{
|
||||
return m_perf_query[i];
|
||||
return *m_perf_query[i];
|
||||
} // getGPUTimer
|
||||
#endif
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -856,6 +905,13 @@ void IrrDriver::applyResolutionSettings()
|
||||
SharedGPUObjects::reset();
|
||||
initDevice();
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
for (unsigned i = 0; i < Q_LAST; i++)
|
||||
{
|
||||
m_perf_query[i]->reset();
|
||||
}
|
||||
#endif
|
||||
|
||||
font_manager = new FontManager();
|
||||
font_manager->loadFonts();
|
||||
// Re-init GUI engine
|
||||
|
@ -281,6 +281,7 @@ public:
|
||||
void printRenderStats();
|
||||
void requestScreenshot();
|
||||
class GPUTimer &getGPUTimer(unsigned);
|
||||
const char* getGPUQueryPhaseName(unsigned);
|
||||
|
||||
#ifndef SERVER_ONLY
|
||||
std::unique_ptr<RenderTarget> createRenderTarget(const irr::core::dimension2du &dimension,
|
||||
|
@ -67,6 +67,8 @@ std::array<float, 16>* g_joint_ptr = NULL;
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sp_culling = true;
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sp_apitrace = false;
|
||||
// ----------------------------------------------------------------------------
|
||||
bool sp_debug_view = false;
|
||||
// ----------------------------------------------------------------------------
|
||||
bool g_handle_shadow = false;
|
||||
|
@ -93,6 +93,7 @@ extern unsigned sp_shadow_poly_count;
|
||||
extern int sp_cur_shadow_cascade;
|
||||
extern bool sp_culling;
|
||||
extern bool sp_debug_view;
|
||||
extern bool sp_apitrace;
|
||||
extern unsigned sp_cur_player;
|
||||
extern unsigned sp_cur_buf_id[MAX_PLAYER_COUNT];
|
||||
extern irr::core::vector3df sp_wind_dir;
|
||||
|
@ -65,7 +65,7 @@ namespace GUIEngine
|
||||
|
||||
std::shared_ptr<RenderInfo> m_render_info;
|
||||
|
||||
const unsigned m_rtt_size;
|
||||
unsigned m_rtt_size;
|
||||
|
||||
public:
|
||||
|
||||
@ -85,6 +85,8 @@ namespace GUIEngine
|
||||
|
||||
void update(float delta);
|
||||
|
||||
void setRTTSize(unsigned rtt_size) { m_rtt_size = rtt_size; }
|
||||
|
||||
virtual void elementRemoved();
|
||||
|
||||
/** Disables any model rotation */
|
||||
|
10
src/main.cpp
10
src/main.cpp
@ -189,6 +189,7 @@
|
||||
#include "graphics/material_manager.hpp"
|
||||
#include "graphics/particle_kind_manager.hpp"
|
||||
#include "graphics/referee.hpp"
|
||||
#include "graphics/sp/sp_base.hpp"
|
||||
#include "guiengine/engine.hpp"
|
||||
#include "guiengine/event_handler.hpp"
|
||||
#include "guiengine/dialog_queue.hpp"
|
||||
@ -632,6 +633,9 @@ void cmdLineHelp()
|
||||
" Takes precedence over trilinear or bilinear\n"
|
||||
" texture filtering.\n"
|
||||
" --shadows=n Set resolution of shadows (0 to disable).\n"
|
||||
" --apitrace This will disable buffer storage and\n"
|
||||
" writing gpu query strings to opengl, which\n"
|
||||
" can be seen later in apitrace.\n"
|
||||
"\n"
|
||||
"You can visit SuperTuxKart's homepage at "
|
||||
"https://supertuxkart.net\n\n",
|
||||
@ -710,6 +714,12 @@ int handleCmdLinePreliminary()
|
||||
UserConfigParams::m_verbosity |= UserConfigParams::LOG_ALL;
|
||||
//if(CommandLine::has("--online"))
|
||||
MainMenuScreen::m_enable_online=true;
|
||||
#if !(defined(SERVER_ONLY) || defined(ANDROID))
|
||||
if(CommandLine::has("--apitrace"))
|
||||
{
|
||||
SP::sp_apitrace = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string s;
|
||||
if(CommandLine::has("--stk-config", &s))
|
||||
|
@ -40,9 +40,14 @@ void override_default_params()
|
||||
// Disable advanced lighting by default to make the game playable
|
||||
UserConfigParams::m_dynamic_lights = false;
|
||||
|
||||
// Enable touch steering and screen keyboard
|
||||
UserConfigParams::m_multitouch_enabled = true;
|
||||
UserConfigParams::m_screen_keyboard = true;
|
||||
// Enable touch steering and screen keyboard when touchscreen is available
|
||||
int32_t touch = AConfiguration_getTouchscreen(global_android_app->config);
|
||||
|
||||
if (touch != ACONFIGURATION_TOUCHSCREEN_NOTOUCH)
|
||||
{
|
||||
UserConfigParams::m_multitouch_enabled = true;
|
||||
UserConfigParams::m_screen_keyboard = true;
|
||||
}
|
||||
|
||||
// It shouldn't matter, but STK is always run in fullscreen on android
|
||||
UserConfigParams::m_fullscreen = true;
|
||||
@ -62,14 +67,14 @@ void android_main(struct android_app* app)
|
||||
{
|
||||
Log::info("AndroidMain", "Loading application...");
|
||||
|
||||
app_dummy();
|
||||
global_android_app = app;
|
||||
|
||||
// Initialize global Android window state variables
|
||||
CIrrDeviceAndroid::onCreate();
|
||||
|
||||
app_dummy();
|
||||
override_default_params();
|
||||
|
||||
global_android_app = app;
|
||||
main(0, {});
|
||||
|
||||
Log::info("AndroidMain", "Closing STK...");
|
||||
|
@ -32,7 +32,7 @@ using namespace GUIEngine;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp)
|
||||
: ModalDialog(0.75f, 0.75f, MODAL_DIALOG_LOCATION_BOTTOM)
|
||||
: ModalDialog(0.75f, 0.75f, MODAL_DIALOG_LOCATION_CENTER)
|
||||
{
|
||||
loadFromFile("kart_color_slider.stkgui");
|
||||
m_player_profile = pp;
|
||||
@ -45,19 +45,16 @@ KartColorSliderDialog::KartColorSliderDialog(PlayerProfile* pp)
|
||||
// ----------------------------------------------------------------------------
|
||||
KartColorSliderDialog::~KartColorSliderDialog()
|
||||
{
|
||||
if (m_model_view->getIrrlichtElement() != NULL)
|
||||
{
|
||||
m_model_view->getIrrlichtElement()->remove();
|
||||
}
|
||||
} // ~KartColorSliderDialog
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
void KartColorSliderDialog::beforeAddingWidgets()
|
||||
{
|
||||
Widget* kart_screen = getWidget<Widget>("kart-screen");
|
||||
m_model_view = new ModelViewWidget(
|
||||
irr_driver->getActualScreenSize().Height > 1280 ||
|
||||
irr_driver->getActualScreenSize().Width > 1280 ? 1024 : 512);
|
||||
m_model_view = getWidget<ModelViewWidget>("model");
|
||||
|
||||
const core::dimension2du screen_size = irr_driver->getActualScreenSize();
|
||||
bool need_hd_rtt = (screen_size.Width > 1280 || screen_size.Height > 1280);
|
||||
m_model_view->setRTTSize(need_hd_rtt ? 1024 : 512);
|
||||
|
||||
const KartProperties* props =
|
||||
kart_properties_manager->getKart(UserConfigParams::m_default_kart);
|
||||
@ -128,9 +125,6 @@ void KartColorSliderDialog::beforeAddingWidgets()
|
||||
|
||||
m_model_view->setRotateContinuously(35.0f);
|
||||
m_model_view->update(0);
|
||||
kart_screen->getChildren().push_back(m_model_view);
|
||||
m_model_view->move(kart_screen->m_w / 2, kart_screen->m_h / 2,
|
||||
kart_screen->m_w / 2, kart_screen->m_w / 2);
|
||||
} // beforeAddingWidgets
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
@ -539,7 +539,7 @@ void OptionsScreenDevice::eventCallback(Widget* widget,
|
||||
|
||||
binding_to_set = (PlayerAction)n;
|
||||
|
||||
new PressAKeyDialog(0.4f, 0.4f);
|
||||
new PressAKeyDialog(0.5f, 0.4f);
|
||||
|
||||
if (m_config->isKeyboard())
|
||||
{
|
||||
|
@ -138,16 +138,25 @@ void Log::printMessage(int level, const char *component, const char *format,
|
||||
|
||||
static const char *names[] = { "debug", "verbose ", "info ",
|
||||
"warn ", "error ", "fatal " };
|
||||
const int MAX_LENGTH = 2048;
|
||||
const int MAX_LENGTH = 4096;
|
||||
char line[MAX_LENGTH + 1];
|
||||
int index = 0;
|
||||
if (!m_prefix.empty())
|
||||
index += snprintf(line+index, MAX_LENGTH-index, "%s ", m_prefix.c_str());
|
||||
int remaining = MAX_LENGTH;
|
||||
|
||||
index += snprintf (line + index, MAX_LENGTH - index, "[%s] %s: ", names[level], component);
|
||||
index += vsnprintf(line + index, MAX_LENGTH - index, format, args);
|
||||
if (!m_prefix.empty())
|
||||
{
|
||||
index += snprintf(line+index, remaining, "%s ", m_prefix.c_str());
|
||||
remaining = MAX_LENGTH - index > 0 ? MAX_LENGTH - index : 0;
|
||||
}
|
||||
|
||||
index += snprintf (line + index, remaining, "[%s] %s: ", names[level], component);
|
||||
remaining = MAX_LENGTH - index > 0 ? MAX_LENGTH - index : 0;
|
||||
index += vsnprintf(line + index, remaining, format, args);
|
||||
remaining = MAX_LENGTH - index > 0 ? MAX_LENGTH - index : 0;
|
||||
va_end(args);
|
||||
index = snprintf (line + index, MAX_LENGTH - index, "\n");
|
||||
|
||||
index = index > MAX_LENGTH - 1 ? MAX_LENGTH - 1 : index;
|
||||
sprintf(line + index, "\n");
|
||||
|
||||
// If the data is not buffered, immediately print it:
|
||||
if (m_buffer_size <= 1)
|
||||
|
@ -35,33 +35,6 @@
|
||||
#include <stack>
|
||||
#include <sstream>
|
||||
|
||||
static const char* GPU_Phase[Q_LAST] =
|
||||
{
|
||||
"Shadows Cascade 0",
|
||||
"Shadows Cascade 1",
|
||||
"Shadows Cascade 2",
|
||||
"Shadows Cascade 3",
|
||||
"Solid Pass",
|
||||
"Env Map",
|
||||
"SunLight",
|
||||
"PointLights",
|
||||
"SSAO",
|
||||
"Light Scatter",
|
||||
"Glow",
|
||||
"Combine Diffuse Color",
|
||||
"Skybox",
|
||||
"Transparent",
|
||||
"Particles",
|
||||
"Depth of Field",
|
||||
"Godrays",
|
||||
"Bloom",
|
||||
"Tonemap",
|
||||
"Motion Blur",
|
||||
"Lightning",
|
||||
"MLAA",
|
||||
"GUI",
|
||||
};
|
||||
|
||||
Profiler profiler;
|
||||
|
||||
// Unit is in pencentage of the screen dimensions
|
||||
@ -486,7 +459,7 @@ void Profiler::draw()
|
||||
if (hovered_gpu_marker != Q_LAST)
|
||||
{
|
||||
std::ostringstream oss;
|
||||
oss << GPU_Phase[hovered_gpu_marker] << " : "
|
||||
oss << irr_driver->getGPUQueryPhaseName(hovered_gpu_marker) << " : "
|
||||
<< hovered_gpu_marker_elapsed << " us";
|
||||
font->draw(oss.str().c_str(), GPU_MARKERS_NAMES_POS,
|
||||
video::SColor(0xFF, 0xFF, 0x00, 0x00));
|
||||
@ -590,7 +563,7 @@ void Profiler::writeToFile()
|
||||
|
||||
for (unsigned i = 0; i < Q_LAST; i++)
|
||||
{
|
||||
f_gpu << "\"" << GPU_Phase[i] << "(" << i+1 << ")\" ";
|
||||
f_gpu << "\"" << irr_driver->getGPUQueryPhaseName(i) << "(" << i+1 << ")\" ";
|
||||
} // for i < Q_LAST
|
||||
f_gpu << std::endl;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user