Move FpsLimiter to overlay.cpp

pull/642/merge
jackun 2 years ago
parent a26e6325cc
commit 2f5efc320a
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -49,6 +49,17 @@ bool gpu_metrics_exists = false;
bool steam_focused = false;
vector<float> frametime_data(200,0.f);
void FpsLimiter(struct fps_limit& stats){
stats.sleepTime = stats.targetFrameTime - (stats.frameStart - stats.frameEnd);
if (stats.sleepTime > stats.frameOverhead) {
auto adjustedSleep = stats.sleepTime - stats.frameOverhead;
this_thread::sleep_for(adjustedSleep);
stats.frameOverhead = ((Clock::now() - stats.frameStart) - adjustedSleep);
if (stats.frameOverhead > stats.targetFrameTime / 2)
stats.frameOverhead = Clock::duration(0);
}
}
void update_hw_info(struct overlay_params& params, uint32_t vendorID)
{
if (params.enabled[OVERLAY_PARAM_ENABLED_cpu_stats] || logger->is_active()) {

@ -1543,17 +1543,6 @@ static void overlay_DestroySwapchainKHR(
destroy_swapchain_data(swapchain_data);
}
void FpsLimiter(struct fps_limit& stats){
stats.sleepTime = stats.targetFrameTime - (stats.frameStart - stats.frameEnd);
if (stats.sleepTime > stats.frameOverhead) {
auto adjustedSleep = stats.sleepTime - stats.frameOverhead;
this_thread::sleep_for(adjustedSleep);
stats.frameOverhead = ((Clock::now() - stats.frameStart) - adjustedSleep);
if (stats.frameOverhead > stats.targetFrameTime / 2)
stats.frameOverhead = Clock::duration(0);
}
}
static VkResult overlay_QueuePresentKHR(
VkQueue queue,
const VkPresentInfoKHR* pPresentInfo)

Loading…
Cancel
Save