Add swapchain (work in progress)
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s
Some checks failed
Build legacy Nix package on Ubuntu / build (push) Failing after 0s
This commit is contained in:
parent
caa79270db
commit
ee8b886aec
7 changed files with 139 additions and 13 deletions
|
@ -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
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue