tilo_presentation/
damage.rs1#[derive(Clone, Copy, Debug, PartialEq, Eq)]
5pub struct DamageRect {
6 pub x: u32,
7 pub y: u32,
8 pub width: u32,
9 pub height: u32,
10}
11
12#[cfg(all(feature = "gpu-damage", not(target_arch = "wasm32")))]
15pub fn set_next_present_damage(surface: &wgpu::Surface<'_>, damage: &[DamageRect]) -> bool {
16 #[cfg(all(feature = "vulkan-damage", target_os = "linux"))]
17 {
18 let regions: Vec<_> = damage
19 .iter()
20 .map(|rect| wgpu::hal::vulkan::PresentDamageRect {
21 x: rect.x,
22 y: rect.y,
23 width: rect.width,
24 height: rect.height,
25 })
26 .collect();
27 if let Some(hal) = unsafe { surface.as_hal::<wgpu::hal::vulkan::Api>() } {
31 hal.set_next_present_damage(®ions);
32 return true;
33 }
34 }
35 let _ = (surface, damage);
36 false
37}