aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2023-05-12 12:02:14 -0400
committerDavid Robillard <d@drobilla.net>2023-05-12 12:05:27 -0400
commit5a0a47b8740a847e2524de0357af437e2b5b52ac (patch)
tree896fe957330c801ebf10c2a349a8dbdc05f8d748
parentad8ecdfbb77f831f501667556ad93144f00f8db6 (diff)
downloadpugl-5a0a47b8740a847e2524de0357af437e2b5b52ac.tar.gz
pugl-5a0a47b8740a847e2524de0357af437e2b5b52ac.tar.bz2
pugl-5a0a47b8740a847e2524de0357af437e2b5b52ac.zip
Windows: Improve the frame rate of demos with vsync
-rw-r--r--examples/pugl_shader_demo.c3
-rw-r--r--examples/pugl_vulkan_cpp_demo.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/examples/pugl_shader_demo.c b/examples/pugl_shader_demo.c
index 63a86ab..178278b 100644
--- a/examples/pugl_shader_demo.c
+++ b/examples/pugl_shader_demo.c
@@ -433,7 +433,8 @@ updateTimeout(const PuglTestApp* const app)
const int refreshRate = puglGetViewHint(app->view, PUGL_REFRESH_RATE);
const double now = puglGetTime(app->world);
const double nextFrameEndTime = app->lastFrameEndTime + (1.0 / refreshRate);
- const double nextExposeTime = nextFrameEndTime - app->lastDrawDuration;
+ const double neededTime = 1.5 * app->lastDrawDuration;
+ const double nextExposeTime = nextFrameEndTime - neededTime;
const double timeUntilNext = nextExposeTime - now;
return timeUntilNext;
diff --git a/examples/pugl_vulkan_cpp_demo.cpp b/examples/pugl_vulkan_cpp_demo.cpp
index bb1448d..eb41b09 100644
--- a/examples/pugl_vulkan_cpp_demo.cpp
+++ b/examples/pugl_vulkan_cpp_demo.cpp
@@ -1803,7 +1803,7 @@ run(const char* const programPath,
const int refreshRate = app.view.getHint(pugl::ViewHint::refreshRate);
const double frameDuration = 1.0 / static_cast<double>(refreshRate);
- const double timeout = app.opts.sync ? frameDuration : 0.0;
+ const double timeout = app.opts.sync ? frameDuration * 0.8 : 0.0;
PuglFpsPrinter fpsPrinter = {app.world.time()};
app.view.show(pugl::ShowCommand::passive);