vulkan: Fix compile errors reported in Issue #946.

This commit is contained in:
BearOso 2024-09-06 13:35:46 -05:00
parent 645a4712e7
commit 5449e2d3c5
4 changed files with 14 additions and 2 deletions

View File

@ -224,27 +224,33 @@ bool Context::init_device(int preferred_device)
};
auto device_list = instance->enumeratePhysicalDevices().value;
physical_device = nullptr;
bool device_chosen = false;
physical_device = vk::PhysicalDevice();
if (preferred_device > -1 &&
(size_t)preferred_device < device_list.size() &&
check_extensions(required_extensions, device_list[preferred_device]))
{
physical_device = device_list[preferred_device];
device_chosen = true;
}
if (physical_device == nullptr)
if (!device_chosen)
{
for (auto &device : device_list)
{
if (check_extensions(required_extensions, device))
{
physical_device = device;
device_chosen = true;
break;
}
}
}
if (!device_chosen)
return false;
graphics_queue_family_index = find_graphics_queue(physical_device);
if (graphics_queue_family_index == UINT32_MAX)
return false;

View File

@ -1,3 +1,5 @@
#include <cassert>
#include "vulkan_pipeline_image.hpp"
#include "slang_helpers.hpp"

View File

@ -1,3 +1,5 @@
#include <cassert>
#include "vulkan_shader_chain.hpp"
#include "slang_helpers.hpp"
#include "stb_image.h"

View File

@ -1,3 +1,5 @@
#include <cassert>
#include "vulkan_texture.hpp"
#include "vulkan/vulkan_enums.hpp"
#include "slang_helpers.hpp"