diff --git a/src/render/graphics.rs b/src/render/graphics.rs index 07914ea..470138a 100644 --- a/src/render/graphics.rs +++ b/src/render/graphics.rs @@ -65,7 +65,7 @@ pub struct GraphicsRenderer { instance_ptr: *mut ColorInstance, instance_count: usize, - _window: Arc, + window: Arc, } impl GraphicsRenderer { @@ -300,7 +300,7 @@ impl GraphicsRenderer { image_available, render_finished, in_flight, frame_index: 0, vertex_buffer, vertex_memory, index_buffer, index_memory, instance_buffer, instance_memory, instance_ptr, instance_count, - _window: window, + window, }) } @@ -451,7 +451,12 @@ impl GraphicsRenderer { let new_extent = if caps.current_extent.width != u32::MAX { caps.current_extent } else { - return; + // Wayland: surface extent is undefined, use window inner size + let inner = self.window.inner_size(); + vk::Extent2D { + width: inner.width.max(1), + height: inner.height.max(1), + } }; if new_extent.width == self.swapchain_extent.width diff --git a/src/render/vulkan.rs b/src/render/vulkan.rs index a3f71d9..2f46243 100644 --- a/src/render/vulkan.rs +++ b/src/render/vulkan.rs @@ -85,6 +85,7 @@ pub struct VulkanRenderer { descriptor_set: vk::DescriptorSet, descriptor_set_layout: vk::DescriptorSetLayout, tick_count: u64, + window: Arc, } impl VulkanRenderer { @@ -157,6 +158,7 @@ impl VulkanRenderer { instance_buffer, instance_memory, instance_ptr, instance_count, descriptor_pool, descriptor_set, descriptor_set_layout, tick_count: 0, + window, }) } @@ -321,7 +323,12 @@ impl VulkanRenderer { let new_extent = if caps.current_extent.width != u32::MAX { caps.current_extent } else { - return; + // Wayland: surface extent is undefined, use window inner size + let inner = self.window.inner_size(); + vk::Extent2D { + width: inner.width.max(1), + height: inner.height.max(1), + } }; if new_extent.width == self.swapchain_extent.width