From b7ca1aad5d4f391152c3c803f4806ea85c30230a Mon Sep 17 00:00:00 2001 From: saschawillems Date: Tue, 30 Aug 2016 21:53:15 +0200 Subject: [PATCH] Use debug marker flag from vulkanDevice class, fixed fps display (sync with actual frame time) --- base/vulkanexamplebase.cpp | 6 +++--- base/vulkanexamplebase.h | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index aff93a0d..abbb2f9f 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -197,7 +197,7 @@ void VulkanExampleBase::createPipelineCache() void VulkanExampleBase::prepare() { - if (enableDebugMarkers) + if (vulkanDevice->enableDebugMarkers) { vkDebug::DebugMarker::setup(device); } @@ -404,7 +404,7 @@ void VulkanExampleBase::renderLoop() std::string windowTitle = getWindowTitle(); SetWindowText(window, windowTitle.c_str()); } - lastFPS = frameCounter; + lastFPS = roundf(1.0f / frameTimer); updateTextOverlay(); fpsTimer = 0.0f; frameCounter = 0; @@ -575,7 +575,7 @@ void VulkanExampleBase::updateTextOverlay() textOverlay->addText(title, 5.0f, 5.0f, VulkanTextOverlay::alignLeft); std::stringstream ss; - ss << std::fixed << std::setprecision(2) << (frameTimer * 1000.0f) << "ms (" << lastFPS << " fps)"; + ss << std::fixed << std::setprecision(3) << (frameTimer * 1000.0f) << "ms (" << lastFPS << " fps)"; textOverlay->addText(ss.str(), 5.0f, 25.0f, VulkanTextOverlay::alignLeft); textOverlay->addText(deviceProperties.deviceName, 5.0f, 45.0f, VulkanTextOverlay::alignLeft); diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index 61e2cada..fea1ded6 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -52,8 +52,6 @@ class VulkanExampleBase private: // Set to true when example is created with enabled validation layers bool enableValidation = false; - // Set to true when the debug marker extension is detected - bool enableDebugMarkers = false; // Set to true if v-sync will be forced for the swapchain bool enableVSync = false; // Device features enabled by the example