mirror of
https://github.com/charles-lunarg/vk-bootstrap.git
synced 2024-11-22 15:24:34 +00:00
Explicit swapchain constructor no longer uses queue indexes
The second constructor for vkb::Swapchain now queries for the index of the graphics and present queue by itself. This removes the need to users to manually specify it and limits the strict dependency between swapchain and the rest of the vkb structs (Instance & Device mainly)
This commit is contained in:
parent
959979b07a
commit
ace1ccf854
@ -1192,16 +1192,19 @@ SwapchainBuilder::SwapchainBuilder (Device const& device) {
|
|||||||
info.present_queue_index = graphics.value ();
|
info.present_queue_index = graphics.value ();
|
||||||
}
|
}
|
||||||
|
|
||||||
SwapchainBuilder::SwapchainBuilder (VkPhysicalDevice const physical_device,
|
SwapchainBuilder::SwapchainBuilder (
|
||||||
VkDevice const device,
|
VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface) {
|
||||||
VkSurfaceKHR const surface,
|
|
||||||
uint32_t graphics_queue_index,
|
|
||||||
uint32_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;
|
auto queue_families = detail::get_vector_noerror<VkQueueFamilyProperties> (
|
||||||
info.present_queue_index = present_queue_index;
|
vkGetPhysicalDeviceQueueFamilyProperties, physical_device);
|
||||||
|
|
||||||
|
int graphics_queue_index = detail::get_graphics_queue_index (queue_families);
|
||||||
|
int present_queue_index = detail::get_present_queue_index (physical_device, surface, queue_families);
|
||||||
|
// TODO: handle queue indexes being below zero
|
||||||
|
info.graphics_queue_index = static_cast<uint32_t> (graphics_queue_index);
|
||||||
|
info.present_queue_index = static_cast<uint32_t> (present_queue_index);
|
||||||
}
|
}
|
||||||
detail::Expected<Swapchain, detail::Error<SwapchainError>> SwapchainBuilder::build () const {
|
detail::Expected<Swapchain, detail::Error<SwapchainError>> SwapchainBuilder::build () const {
|
||||||
return build (VK_NULL_HANDLE);
|
return build (VK_NULL_HANDLE);
|
||||||
|
@ -523,11 +523,7 @@ void destroy_swapchain (Swapchain const& swapchain);
|
|||||||
class SwapchainBuilder {
|
class SwapchainBuilder {
|
||||||
public:
|
public:
|
||||||
SwapchainBuilder (Device const& device);
|
SwapchainBuilder (Device const& device);
|
||||||
SwapchainBuilder (VkPhysicalDevice const physical_device,
|
SwapchainBuilder (VkPhysicalDevice const physical_device, VkDevice const device, VkSurfaceKHR const surface);
|
||||||
VkDevice const device,
|
|
||||||
VkSurfaceKHR const surface,
|
|
||||||
uint32_t graphics_queue_index,
|
|
||||||
uint32_t present_queue_index);
|
|
||||||
|
|
||||||
detail::Expected<Swapchain, detail::Error<SwapchainError>> build () const;
|
detail::Expected<Swapchain, detail::Error<SwapchainError>> build () const;
|
||||||
detail::Expected<Swapchain, detail::Error<SwapchainError>> recreate (Swapchain const& swapchain) const;
|
detail::Expected<Swapchain, detail::Error<SwapchainError>> recreate (Swapchain const& swapchain) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user