Changeset 187b0f5 in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Mar 11, 2021, 2:44:43 AM (3 years ago)
Author:
Dmitry Portnoy <dportnoy@…>
Branches:
feature/imgui-sdl
Children:
301c90a
Parents:
20e4c2b
git-author:
Dmitry Portnoy <dportnoy@…> (03/11/21 02:39:25)
git-committer:
Dmitry Portnoy <dportnoy@…> (03/11/21 02:44:43)
Message:

Change VulkanGame and SDLGame to only use discrete GPUs and switch the timer class to steady_clock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r20e4c2b r187b0f5  
    5959   swapChainPresentMode = VK_PRESENT_MODE_MAX_ENUM_KHR;
    6060   swapChainMinImageCount = 0;
    61 
    6261   currentFrame = 0;
     62   imageIndex = 0;
    6363   shouldRecreateSwapChain = false;
    6464
     
    706706
    707707void VulkanGame::renderLoop() {
    708    startTime = high_resolution_clock::now();
    709    curTime = duration<float, seconds::period>(high_resolution_clock::now() - startTime).count();
     708   startTime = steady_clock::now();
     709   curTime = duration<float, seconds::period>(steady_clock::now() - startTime).count();
    710710
    711711   fpsStartTime = curTime;
     
    720720
    721721      this->prevTime = curTime;
    722       curTime = duration<float, seconds::period>(high_resolution_clock::now() - this->startTime).count();
     722      curTime = duration<float, seconds::period>(steady_clock::now() - this->startTime).count();
    723723      this->elapsedTime = curTime - this->prevTime;
    724724
     
    901901            recreateSwapChain();
    902902
    903             imageIndex = 0;
    904903            shouldRecreateSwapChain = false;
    905904         }
     
    12771276
    12781277   cout << "Device: " << deviceProperties.deviceName << endl;
     1278
     1279   // TODO: Eventually, maybe let the user pick out of a set of GPUs in case the user does want to use
     1280   // an integrated GPU. On my laptop, this function returns TRUE for the integrated GPU, but crashes
     1281   // when trying to use it to render. Maybe I just need to figure out which other extensions and features
     1282   // to check.
     1283   if (deviceProperties.deviceType != VkPhysicalDeviceType::VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU) {
     1284      return false;
     1285   }
    12791286
    12801287   QueueFamilyIndices indices = VulkanUtils::findQueueFamilies(physicalDevice, surface);
Note: See TracChangeset for help on using the changeset viewer.