chore: removed validation layer requirement for functionality on my laptop

This commit is contained in:
alphafetus committed 2026-05-17 11:35:14 -04:00
1 parent 44cd6fff96
commit a7deec14a5
1 file changed
+8 -10
+8 -10
View File
@@ -235,7 +235,7 @@ impl VulkanContext {
Ok(r) => r, Ok(r) => r,
Err(VulkanError::OutOfDate) => { Err(VulkanError::OutOfDate) => {
println!("Swapchain is out of date!"); println!("Swapchain is out of date!");
self.recreate_swapchain(true)?; self.recreate_window_size_dependent(true)?;
return Ok(()); return Ok(());
} }
Err(e) => panic!("Failed to acquire next image: {:?}", e), Err(e) => panic!("Failed to acquire next image: {:?}", e),
@@ -245,7 +245,7 @@ impl VulkanContext {
// This is fixed by recreating the swapchain, but we'll have to skip this frame. // This is fixed by recreating the swapchain, but we'll have to skip this frame.
if suboptimal { if suboptimal {
println!("Swapchain is suboptimal!"); println!("Swapchain is suboptimal!");
self.recreate_swapchain(false)? self.recreate_window_size_dependent(false)?
} }
// Rebuild command buffers // Rebuild command buffers
@@ -504,12 +504,11 @@ impl VulkanContext {
Ok(buffer) Ok(buffer)
} }
/// Handles recreation logic for the [`Swapchain`] by using the current information and any new /// Handles recreation logic for the [`Swapchain`] and [`Framebuffer`] by using the current
/// bounds. Will also handle resizing logic, as this requires extra information to be updated, /// information and any new bounds. Will also handle resizing logic, as this requires extra
/// specifically the [`GraphicsPipeline`] and [`PrimaryAutoCommandBuffer`]. All information is /// information to be updated, specifically the [`GraphicsPipeline`] and [`PrimaryAutoCommandBuffer`].
/// automatically set within the `VulkanContext`. /// All information is automatically set within this `VulkanContext`.
// TODO Define a function that handles creation of all information related to the size of the window. pub fn recreate_window_size_dependent(&mut self, resized: bool) -> Result<(), Box<dyn Error>> {
pub fn recreate_swapchain(&mut self, resized: bool) -> Result<(), Box<dyn Error>> {
unsafe { unsafe {
self.device.wait_idle()?; self.device.wait_idle()?;
}; };
@@ -583,7 +582,6 @@ impl App {
library, library,
InstanceCreateInfo { InstanceCreateInfo {
flags: InstanceCreateFlags::ENUMERATE_PORTABILITY, flags: InstanceCreateFlags::ENUMERATE_PORTABILITY,
enabled_layers: vec!["VK_LAYER_KHRONOS_validation".to_string()],
enabled_extensions: required_extensions, enabled_extensions: required_extensions,
..Default::default() ..Default::default()
}, },
@@ -621,7 +619,7 @@ impl ApplicationHandler for App {
); );
if let Some(context) = self.context.as_mut() { if let Some(context) = self.context.as_mut() {
context context
.recreate_swapchain(true) .recreate_window_size_dependent(true)
.expect("Failed to recreate swapchain"); .expect("Failed to recreate swapchain");
} }
} }