mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 23:24:34 +00:00
Make swapchain builder find queues if none were provided
This commit is contained in:
parent
e2a09c9b35
commit
988c0ea4e4
@ -1541,19 +1541,20 @@ SwapchainBuilder::SwapchainBuilder (Device const& device, VkSurfaceKHR const sur
|
|||||||
info.graphics_queue_index = present.value ();
|
info.graphics_queue_index = present.value ();
|
||||||
info.present_queue_index = graphics.value ();
|
info.present_queue_index = graphics.value ();
|
||||||
}
|
}
|
||||||
SwapchainBuilder::SwapchainBuilder (VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface, uint32_t graphics_queue_index){
|
SwapchainBuilder::SwapchainBuilder (VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface, int32_t graphics_queue_index, int32_t present_queue_index){
|
||||||
info.physical_device = physical_device;
|
info.physical_device = physical_device;
|
||||||
info.device = device;
|
info.device = device;
|
||||||
info.surface = surface;
|
info.surface = surface;
|
||||||
info.graphics_queue_index = graphics_queue_index;
|
info.graphics_queue_index = static_cast<uint32_t>(graphics_queue_index);
|
||||||
info.present_queue_index = graphics_queue_index;
|
info.present_queue_index = static_cast<uint32_t>(present_queue_index);
|
||||||
}
|
if (graphics_queue_index < 0 || present_queue_index < 0) {
|
||||||
SwapchainBuilder::SwapchainBuilder (VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface, uint32_t graphics_queue_index, uint32_t present_queue_index){
|
auto queue_families = detail::get_vector_noerror<VkQueueFamilyProperties> (
|
||||||
info.physical_device = physical_device;
|
detail::vulkan_functions().fp_vkGetPhysicalDeviceQueueFamilyProperties, physical_device);
|
||||||
info.device = device;
|
if (graphics_queue_index < 0)
|
||||||
info.surface = surface;
|
info.graphics_queue_index = static_cast<uint32_t>(detail::get_graphics_queue_index (queue_families));
|
||||||
info.graphics_queue_index = graphics_queue_index;
|
if (present_queue_index < 0)
|
||||||
info.present_queue_index = present_queue_index;
|
info.present_queue_index = static_cast<uint32_t>(detail::get_present_queue_index (physical_device, surface, queue_families));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
detail::Result<Swapchain> SwapchainBuilder::build () const {
|
detail::Result<Swapchain> SwapchainBuilder::build () const {
|
||||||
if (info.surface == VK_NULL_HANDLE) {
|
if (info.surface == VK_NULL_HANDLE) {
|
||||||
|
@ -556,8 +556,7 @@ class SwapchainBuilder {
|
|||||||
public:
|
public:
|
||||||
explicit SwapchainBuilder (Device const& device);
|
explicit SwapchainBuilder (Device const& device);
|
||||||
explicit SwapchainBuilder (Device const& device, VkSurfaceKHR const surface);
|
explicit SwapchainBuilder (Device const& device, VkSurfaceKHR const surface);
|
||||||
explicit SwapchainBuilder (VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface, uint32_t graphics_queue_index);
|
explicit SwapchainBuilder (VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface, int32_t graphics_queue_index = -1, int32_t present_queue_index = -1);
|
||||||
explicit SwapchainBuilder (VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface, uint32_t graphics_queue_index, uint32_t present_queue_index);
|
|
||||||
|
|
||||||
detail::Result<Swapchain> build () const;
|
detail::Result<Swapchain> build () const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user