mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-27 09:12:46 +01:00
vulkan_device: Allow creating a device without surface
This commit is contained in:
parent
d235cf3933
commit
ac1e4734c2
1 changed files with 3 additions and 3 deletions
|
@ -775,7 +775,7 @@ void Device::SetupFamilies(VkSurfaceKHR surface) {
|
||||||
std::optional<u32> graphics;
|
std::optional<u32> graphics;
|
||||||
std::optional<u32> present;
|
std::optional<u32> present;
|
||||||
for (u32 index = 0; index < static_cast<u32>(queue_family_properties.size()); ++index) {
|
for (u32 index = 0; index < static_cast<u32>(queue_family_properties.size()); ++index) {
|
||||||
if (graphics && present) {
|
if (graphics && (present || !surface)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const VkQueueFamilyProperties& queue_family = queue_family_properties[index];
|
const VkQueueFamilyProperties& queue_family = queue_family_properties[index];
|
||||||
|
@ -785,7 +785,7 @@ void Device::SetupFamilies(VkSurfaceKHR surface) {
|
||||||
if (queue_family.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
if (queue_family.queueFlags & VK_QUEUE_GRAPHICS_BIT) {
|
||||||
graphics = index;
|
graphics = index;
|
||||||
}
|
}
|
||||||
if (physical.GetSurfaceSupportKHR(index, surface)) {
|
if (surface && physical.GetSurfaceSupportKHR(index, surface)) {
|
||||||
present = index;
|
present = index;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -793,7 +793,7 @@ void Device::SetupFamilies(VkSurfaceKHR surface) {
|
||||||
LOG_ERROR(Render_Vulkan, "Device lacks a graphics queue");
|
LOG_ERROR(Render_Vulkan, "Device lacks a graphics queue");
|
||||||
throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT);
|
throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT);
|
||||||
}
|
}
|
||||||
if (!present) {
|
if (surface && !present) {
|
||||||
LOG_ERROR(Render_Vulkan, "Device lacks a present queue");
|
LOG_ERROR(Render_Vulkan, "Device lacks a present queue");
|
||||||
throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT);
|
throw vk::Exception(VK_ERROR_FEATURE_NOT_PRESENT);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue