Changeset fe5c3ba in opengl-game for vulkan-game.cpp


Ignore:
Timestamp:
Sep 22, 2019, 2:28:22 AM (5 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
feature/imgui-sdl, master, points-test
Children:
a0c5f28
Parents:
90a424f
Message:

In vulkangame, change the pickPhysicalDevice() and isDeviceSuitable() functions to take the deviceExtensions list as a parameter

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vulkan-game.cpp

    r90a424f rfe5c3ba  
    9090      "VK_LAYER_KHRONOS_validation"
    9191   };
     92   const vector<const char*> deviceExtensions = {
     93      VK_KHR_SWAPCHAIN_EXTENSION_NAME
     94   };
    9295
    9396   createVulkanInstance(validationLayers);
    9497   setupDebugMessenger();
    9598   createVulkanSurface();
    96    pickPhysicalDevice();
     99   pickPhysicalDevice(deviceExtensions);
    97100}
    98101
     
    239242}
    240243
    241 void VulkanGame::pickPhysicalDevice() {
     244void VulkanGame::pickPhysicalDevice(const vector<const char*>& deviceExtensions) {
    242245   uint32_t deviceCount = 0;
    243246   vkEnumeratePhysicalDevices(instance, &deviceCount, nullptr);
     
    252255   cout << endl << "Graphics cards:" << endl;
    253256   for (const VkPhysicalDevice& device : devices) {
    254       if (isDeviceSuitable(device)) {
     257      if (isDeviceSuitable(device, deviceExtensions)) {
    255258         physicalDevice = device;
    256259         break;
     
    264267}
    265268
    266 bool VulkanGame::isDeviceSuitable(VkPhysicalDevice device) {
    267    const vector<const char*> deviceExtensions = {
    268       VK_KHR_SWAPCHAIN_EXTENSION_NAME
    269    };
    270 
     269bool VulkanGame::isDeviceSuitable(VkPhysicalDevice device, const vector<const char*>& deviceExtensions) {
    271270   VkPhysicalDeviceProperties deviceProperties;
    272271   vkGetPhysicalDeviceProperties(device, &deviceProperties);
Note: See TracChangeset for help on using the changeset viewer.