Index: tools/vulkan/win/main_win.cpp |
diff --git a/tools/vulkan/win/main_win.cpp b/tools/vulkan/win/main_win.cpp |
index 34e522a9525e0ba5579cf8490ec04e1201e81521..883b96df9bf8a3dacbf434461a85f7aa1ddb915f 100644 |
--- a/tools/vulkan/win/main_win.cpp |
+++ b/tools/vulkan/win/main_win.cpp |
@@ -9,6 +9,7 @@ |
#include <tchar.h> |
#include "SkTypes.h" |
+#include "Timer.h" |
#include "Window_win.h" |
#include "../Application.h" |
@@ -24,6 +25,8 @@ static char* tchar_to_utf8(const TCHAR* str) { |
#endif |
} |
+static double now_ms() { return SkTime::GetNSecs() * 1e-6; } |
+ |
// This file can work with GUI or CONSOLE subsystem types since we define _tWinMain and main(). |
static int main_common(HINSTANCE hInstance, int show, int argc, char**argv); |
@@ -60,6 +63,10 @@ static int main_common(HINSTANCE hInstance, int show, int argc, char**argv) { |
Application* app = Application::Create(argc, argv, (void*)hInstance); |
MSG msg = { 0 }; |
+ |
+ double currentTime = 0.0; |
+ double previousTime = 0.0; |
+ |
// Main message loop |
while (WM_QUIT != msg.message) { |
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { |
@@ -67,7 +74,9 @@ static int main_common(HINSTANCE hInstance, int show, int argc, char**argv) { |
DispatchMessage(&msg); |
} |
- app->onIdle(0.0f); |
+ previousTime = currentTime; |
+ currentTime = now_ms(); |
+ app->onIdle(currentTime - previousTime); |
} |
delete app; |