Add swapchain (work in progress)
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s

This commit is contained in:
Florian RICHER 2024-11-12 22:01:08 +01:00
parent caa79270db
commit ee8b886aec
Signed by: florian.richer
GPG key ID: C73D37CBED7BFC77
7 changed files with 139 additions and 13 deletions

View file

@ -1,9 +1,11 @@
use crate::vulkan::{VkDevice, VkInstance, VkPhysicalDevice, VkSurface};
use crate::vulkan::{VkDevice, VkInstance, VkPhysicalDevice, VkSurface, VkSwapchain};
use ash::vk::QueueFlags;
pub struct VkRenderContext {
instance: VkInstance,
surface: VkSurface,
device: VkDevice,
swapchain: VkSwapchain
}
impl VkRenderContext {
@ -26,19 +28,20 @@ impl VkRenderContext {
let device = VkDevice::new_graphics_device(&instance, &physical_device, queue_family_index)
.expect("Unable to create device");
let present_queue = device.get_device_queue(0);
let swapchain = surface.create_swapchain(
&window,
&instance,
&device,
&physical_device
).expect("Unable to create swapchain");
let surface_format = surface.get_physical_device_surface_formats(physical_device)
.unwrap_or_default()
.first()
.expect("Unable to get surface format");
let surface_capabilities = surface.get_physical_device_surface_capabilities(physical_device)
.expect("Unable to get surface capabilities");
// let present_queue = device.get_device_queue(0);
Ok(Self {
instance,
surface,
device,
swapchain
})
}
}