@ -67,17 +67,19 @@ VkExtent2D ChooseSwapExtent(const VkSurfaceCapabilitiesKHR& capabilities, u32 wi
} // Anonymous namespace
} // Anonymous namespace
Swapchain : : Swapchain ( VkSurfaceKHR surface_ , const Device & device_ , Scheduler & scheduler_ , u32 width ,
Swapchain : : Swapchain ( VkSurfaceKHR surface_ , const Device & device_ , Scheduler & scheduler_ ,
u32 height, bool srgb )
u32 width_, u32 height_ , bool srgb )
: surface { surface_ } , device { device_ } , scheduler { scheduler_ } {
: surface { surface_ } , device { device_ } , scheduler { scheduler_ } {
Create ( width , height , srgb ) ;
Create ( width _ , height _ , srgb ) ;
}
}
Swapchain : : ~ Swapchain ( ) = default ;
Swapchain : : ~ Swapchain ( ) = default ;
void Swapchain : : Create ( u32 width , u32 height , bool srgb ) {
void Swapchain : : Create ( u32 width _ , u32 height _ , bool srgb ) {
is_outdated = false ;
is_outdated = false ;
is_suboptimal = false ;
is_suboptimal = false ;
width = width_ ;
height = height_ ;
const auto physical_device = device . GetPhysical ( ) ;
const auto physical_device = device . GetPhysical ( ) ;
const auto capabilities { physical_device . GetSurfaceCapabilitiesKHR ( surface ) } ;
const auto capabilities { physical_device . GetSurfaceCapabilitiesKHR ( surface ) } ;
@ -88,7 +90,7 @@ void Swapchain::Create(u32 width, u32 height, bool srgb) {
device . GetLogical ( ) . WaitIdle ( ) ;
device . GetLogical ( ) . WaitIdle ( ) ;
Destroy ( ) ;
Destroy ( ) ;
CreateSwapchain ( capabilities , width, height , srgb) ;
CreateSwapchain ( capabilities , srgb) ;
CreateSemaphores ( ) ;
CreateSemaphores ( ) ;
CreateImageViews ( ) ;
CreateImageViews ( ) ;
@ -148,8 +150,7 @@ void Swapchain::Present(VkSemaphore render_semaphore) {
}
}
}
}
void Swapchain : : CreateSwapchain ( const VkSurfaceCapabilitiesKHR & capabilities , u32 width , u32 height ,
void Swapchain : : CreateSwapchain ( const VkSurfaceCapabilitiesKHR & capabilities , bool srgb ) {
bool srgb ) {
const auto physical_device { device . GetPhysical ( ) } ;
const auto physical_device { device . GetPhysical ( ) } ;
const auto formats { physical_device . GetSurfaceFormatsKHR ( surface ) } ;
const auto formats { physical_device . GetSurfaceFormatsKHR ( surface ) } ;
const auto present_modes { physical_device . GetSurfacePresentModesKHR ( surface ) } ;
const auto present_modes { physical_device . GetSurfacePresentModesKHR ( surface ) } ;