Assign destWidth and destHeight before starting render loop to avoid unnecessary resize on windows, store last fps count

This commit is contained in:
saschawillems 2016-05-03 21:22:45 +02:00
parent ede809ec31
commit 908ef3765c

View file

@ -357,6 +357,8 @@ void VulkanExampleBase::loadMesh(
void VulkanExampleBase::renderLoop() void VulkanExampleBase::renderLoop()
{ {
destWidth = width;
destHeight = height;
#if defined(_WIN32) #if defined(_WIN32)
MSG msg; MSG msg;
while (TRUE) while (TRUE)
@ -393,6 +395,7 @@ void VulkanExampleBase::renderLoop()
{ {
std::string windowTitle = getWindowTitle(); std::string windowTitle = getWindowTitle();
SetWindowText(window, windowTitle.c_str()); SetWindowText(window, windowTitle.c_str());
lastFPS = frameCounter;
fpsTimer = 0.0f; fpsTimer = 0.0f;
frameCounter = 0.0f; frameCounter = 0.0f;
} }
@ -450,6 +453,7 @@ void VulkanExampleBase::renderLoop()
if (fpsTimer > 1000.0f) if (fpsTimer > 1000.0f)
{ {
LOGD("%d fps", frameCounter); LOGD("%d fps", frameCounter);
lastFPS = frameCounter;
fpsTimer = 0.0f; fpsTimer = 0.0f;
frameCounter = 0.0f; frameCounter = 0.0f;
} }
@ -516,6 +520,7 @@ void VulkanExampleBase::renderLoop()
xcb_change_property(connection, XCB_PROP_MODE_REPLACE, xcb_change_property(connection, XCB_PROP_MODE_REPLACE,
window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8, window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8,
windowTitle.size(), windowTitle.c_str()); windowTitle.size(), windowTitle.c_str());
lastFPS = frameCounter;
fpsTimer = 0.0f; fpsTimer = 0.0f;
frameCounter = 0.0f; frameCounter = 0.0f;
} }
@ -1491,7 +1496,7 @@ void VulkanExampleBase::windowResize()
void VulkanExampleBase::windowResized() void VulkanExampleBase::windowResized()
{ {
// Can be overrdiden in derived class // Can be overriden in derived class
} }
void VulkanExampleBase::initSwapchain() void VulkanExampleBase::initSwapchain()