From c548212d42b0565aff127c2a52ba24e42350d3ba Mon Sep 17 00:00:00 2001 From: Adrian Cojocaru Date: Tue, 3 Dec 2024 23:03:06 +0200 Subject: [PATCH] Add latency to surface updates (#3056) --- include/mbgl/vulkan/context.hpp | 3 ++- src/mbgl/vulkan/context.cpp | 22 +++++++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/include/mbgl/vulkan/context.hpp b/include/mbgl/vulkan/context.hpp index e17160d65..08e439df3 100644 --- a/include/mbgl/vulkan/context.hpp +++ b/include/mbgl/vulkan/context.hpp @@ -146,7 +146,7 @@ public: void enqueueDeletion(std::function&& function); void submitOneTimeCommand(const std::function& function) const; - void requestSurfaceUpdate() { surfaceUpdateRequested = true; } + void requestSurfaceUpdate(bool useDelay = true); private: struct FrameResources { @@ -197,6 +197,7 @@ private: uint8_t frameResourceIndex = 0; std::vector frameResources; bool surfaceUpdateRequested{false}; + int32_t surfaceUpdateLatency{0}; int32_t currentFrameCount{0}; struct { diff --git a/src/mbgl/vulkan/context.cpp b/src/mbgl/vulkan/context.cpp index 1acb4d691..9f54ebed2 100644 --- a/src/mbgl/vulkan/context.cpp +++ b/src/mbgl/vulkan/context.cpp @@ -171,6 +171,19 @@ void Context::submitOneTimeCommand(const std::function