mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-29 16:54:35 +00:00
Conditional framerate limiting on GLFW.
This commit is contained in:
parent
e85457815e
commit
30f1b901a9
@ -13,6 +13,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
|
#include "profiler/TracyConfig.hpp"
|
||||||
#include "profiler/TracyImGui.hpp"
|
#include "profiler/TracyImGui.hpp"
|
||||||
|
|
||||||
#include "Backend.hpp"
|
#include "Backend.hpp"
|
||||||
@ -25,6 +26,9 @@ static RunQueue* s_mainThreadTasks;
|
|||||||
static WindowPosition* s_winPos;
|
static WindowPosition* s_winPos;
|
||||||
static bool s_iconified;
|
static bool s_iconified;
|
||||||
|
|
||||||
|
extern tracy::Config s_config;
|
||||||
|
|
||||||
|
|
||||||
static void glfw_error_callback( int error, const char* description )
|
static void glfw_error_callback( int error, const char* description )
|
||||||
{
|
{
|
||||||
fprintf(stderr, "Error %d: %s\n", error, description);
|
fprintf(stderr, "Error %d: %s\n", error, description);
|
||||||
@ -146,10 +150,7 @@ void Backend::Run()
|
|||||||
{
|
{
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
s_redraw();
|
s_redraw();
|
||||||
if( !glfwGetWindowAttrib( s_window, GLFW_FOCUSED ) )
|
if( s_config.focusLostLimit && !glfwGetWindowAttrib( s_window, GLFW_FOCUSED ) ) std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );
|
||||||
{
|
|
||||||
std::this_thread::sleep_for( std::chrono::milliseconds( 50 ) );
|
|
||||||
}
|
|
||||||
s_mainThreadTasks->Run();
|
s_mainThreadTasks->Run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user