Use debug marker flag from vulkanDevice class, fixed fps display (sync with actual frame time)

This commit is contained in:
saschawillems 2016-08-30 21:53:15 +02:00
parent ffeabc7570
commit b7ca1aad5d
2 changed files with 3 additions and 5 deletions

View file

@ -197,7 +197,7 @@ void VulkanExampleBase::createPipelineCache()
void VulkanExampleBase::prepare() void VulkanExampleBase::prepare()
{ {
if (enableDebugMarkers) if (vulkanDevice->enableDebugMarkers)
{ {
vkDebug::DebugMarker::setup(device); vkDebug::DebugMarker::setup(device);
} }
@ -404,7 +404,7 @@ void VulkanExampleBase::renderLoop()
std::string windowTitle = getWindowTitle(); std::string windowTitle = getWindowTitle();
SetWindowText(window, windowTitle.c_str()); SetWindowText(window, windowTitle.c_str());
} }
lastFPS = frameCounter; lastFPS = roundf(1.0f / frameTimer);
updateTextOverlay(); updateTextOverlay();
fpsTimer = 0.0f; fpsTimer = 0.0f;
frameCounter = 0; frameCounter = 0;
@ -575,7 +575,7 @@ void VulkanExampleBase::updateTextOverlay()
textOverlay->addText(title, 5.0f, 5.0f, VulkanTextOverlay::alignLeft); textOverlay->addText(title, 5.0f, 5.0f, VulkanTextOverlay::alignLeft);
std::stringstream ss; 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(ss.str(), 5.0f, 25.0f, VulkanTextOverlay::alignLeft);
textOverlay->addText(deviceProperties.deviceName, 5.0f, 45.0f, VulkanTextOverlay::alignLeft); textOverlay->addText(deviceProperties.deviceName, 5.0f, 45.0f, VulkanTextOverlay::alignLeft);

View file

@ -52,8 +52,6 @@ class VulkanExampleBase
private: private:
// Set to true when example is created with enabled validation layers // Set to true when example is created with enabled validation layers
bool enableValidation = false; 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 // Set to true if v-sync will be forced for the swapchain
bool enableVSync = false; bool enableVSync = false;
// Device features enabled by the example // Device features enabled by the example