mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-26 00:34:35 +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.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.device = device;
|
||||
info.surface = surface;
|
||||
info.graphics_queue_index = graphics_queue_index;
|
||||
info.present_queue_index = graphics_queue_index;
|
||||
info.graphics_queue_index = static_cast<uint32_t>(graphics_queue_index);
|
||||
info.present_queue_index = static_cast<uint32_t>(present_queue_index);
|
||||
if (graphics_queue_index < 0 || present_queue_index < 0) {
|
||||
auto queue_families = detail::get_vector_noerror<VkQueueFamilyProperties> (
|
||||
detail::vulkan_functions().fp_vkGetPhysicalDeviceQueueFamilyProperties, physical_device);
|
||||
if (graphics_queue_index < 0)
|
||||
info.graphics_queue_index = static_cast<uint32_t>(detail::get_graphics_queue_index (queue_families));
|
||||
if (present_queue_index < 0)
|
||||
info.present_queue_index = static_cast<uint32_t>(detail::get_present_queue_index (physical_device, surface, queue_families));
|
||||
}
|
||||
SwapchainBuilder::SwapchainBuilder (VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface, uint32_t graphics_queue_index, uint32_t present_queue_index){
|
||||
info.physical_device = physical_device;
|
||||
info.device = device;
|
||||
info.surface = surface;
|
||||
info.graphics_queue_index = graphics_queue_index;
|
||||
info.present_queue_index = present_queue_index;
|
||||
}
|
||||
detail::Result<Swapchain> SwapchainBuilder::build () const {
|
||||
if (info.surface == VK_NULL_HANDLE) {
|
||||
|
@ -556,8 +556,7 @@ class SwapchainBuilder {
|
||||
public:
|
||||
explicit SwapchainBuilder (Device const& device);
|
||||
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, uint32_t graphics_queue_index, uint32_t present_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);
|
||||
|
||||
detail::Result<Swapchain> build () const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user