This commit is contained in:
parent
e9ce480f96
commit
210a5504ab
6 changed files with 162 additions and 90 deletions
|
@ -4,6 +4,12 @@ use ash::vk;
|
|||
use std::sync::Arc;
|
||||
use winit::raw_window_handle::{HasDisplayHandle, HasWindowHandle};
|
||||
|
||||
pub struct SwapchainSupportDetails(
|
||||
pub Vec<vk::SurfaceFormatKHR>,
|
||||
pub vk::SurfaceCapabilitiesKHR,
|
||||
pub Vec<vk::PresentModeKHR>,
|
||||
);
|
||||
|
||||
pub struct VkSurface {
|
||||
instance: Arc<VkInstance>,
|
||||
pub(super) surface: vk::SurfaceKHR,
|
||||
|
@ -46,14 +52,10 @@ impl VkSurface {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_physical_device_surface_infos(
|
||||
pub fn get_physical_device_swapchain_support_details(
|
||||
&self,
|
||||
physical_device: &VkPhysicalDevice,
|
||||
) -> VkResult<(
|
||||
Vec<vk::SurfaceFormatKHR>,
|
||||
vk::SurfaceCapabilitiesKHR,
|
||||
Vec<vk::PresentModeKHR>,
|
||||
)> {
|
||||
) -> VkResult<SwapchainSupportDetails> {
|
||||
unsafe {
|
||||
let formats = self
|
||||
.instance
|
||||
|
@ -70,7 +72,11 @@ impl VkSurface {
|
|||
.surface_loader
|
||||
.get_physical_device_surface_present_modes(physical_device.handle, self.surface)?;
|
||||
|
||||
Ok((formats, capabilities, present_modes))
|
||||
Ok(SwapchainSupportDetails(
|
||||
formats,
|
||||
capabilities,
|
||||
present_modes,
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue