Fix frame pacing issues (#3032)
This commit is contained in:
@@ -1100,6 +1100,10 @@ void GLFWView::run() {
|
||||
}
|
||||
|
||||
render();
|
||||
|
||||
#ifndef __APPLE__
|
||||
runLoop.updateTime();
|
||||
#endif
|
||||
};
|
||||
|
||||
// Cap frame rate to 60hz if benchmark mode is disabled
|
||||
|
||||
@@ -13,8 +13,9 @@
|
||||
|
||||
class GLFWVulkanRenderableResource final : public mbgl::vulkan::SurfaceRenderableResource {
|
||||
public:
|
||||
explicit GLFWVulkanRenderableResource(GLFWVulkanBackend& backend_)
|
||||
: SurfaceRenderableResource(backend_) {}
|
||||
explicit GLFWVulkanRenderableResource(GLFWVulkanBackend& backend_, bool capFrameRate)
|
||||
: SurfaceRenderableResource(backend_,
|
||||
capFrameRate ? vk::PresentModeKHR::eFifo : vk::PresentModeKHR::eImmediate) {}
|
||||
|
||||
std::vector<const char*> getDeviceExtensions() override { return {VK_KHR_SWAPCHAIN_EXTENSION_NAME}; }
|
||||
|
||||
@@ -34,7 +35,7 @@ public:
|
||||
void bind() override {}
|
||||
};
|
||||
|
||||
GLFWVulkanBackend::GLFWVulkanBackend(GLFWwindow* window_, const bool)
|
||||
GLFWVulkanBackend::GLFWVulkanBackend(GLFWwindow* window_, const bool capFrameRate)
|
||||
: mbgl::vulkan::RendererBackend(mbgl::gfx::ContextMode::Unique),
|
||||
mbgl::vulkan::Renderable(
|
||||
[window_] {
|
||||
@@ -43,7 +44,7 @@ GLFWVulkanBackend::GLFWVulkanBackend(GLFWwindow* window_, const bool)
|
||||
glfwGetFramebufferSize(window_, &fbWidth, &fbHeight);
|
||||
return mbgl::Size{static_cast<uint32_t>(fbWidth), static_cast<uint32_t>(fbHeight)};
|
||||
}(),
|
||||
std::make_unique<GLFWVulkanRenderableResource>(*this)),
|
||||
std::make_unique<GLFWVulkanRenderableResource>(*this, capFrameRate)),
|
||||
window(window_) {
|
||||
init();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user