From 3ab0a9915425e2be4da4efe59d7815f0b3a6882a Mon Sep 17 00:00:00 2001 From: "florent.teppe" Date: Thu, 4 Aug 2022 13:37:12 +0200 Subject: [PATCH] Hot reload done only once every 200 ms, no point in beeing faster it may also help with bugs where the file is still locked and can't be opened --- components/shader/shadermanager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/shader/shadermanager.cpp b/components/shader/shadermanager.cpp index 44a08ddfa3..223ca9cd02 100644 --- a/components/shader/shadermanager.cpp +++ b/components/shader/shadermanager.cpp @@ -387,7 +387,8 @@ namespace Shader void update(ShaderManager& Manager) { - if (mHotReloadEnabled) + auto timeSinceLastCheckMillis = std::chrono::duration_cast(std::filesystem::file_time_type::clock::now() - mLastAutoRecompileTime); + if (mHotReloadEnabled && timeSinceLastCheckMillis.count() > 200) reloadTouchedShaders(Manager); }