#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct DamageRect {
pub x: u32,
pub y: u32,
pub width: u32,
pub height: u32,
}
#[cfg(all(feature = "gpu-damage", not(target_arch = "wasm32")))]
pub fn set_next_present_damage(surface: &wgpu::Surface<'_>, damage: &[DamageRect]) -> bool {
#[cfg(all(feature = "vulkan-damage", target_os = "linux"))]
{
let regions: Vec<_> = damage
.iter()
.map(|rect| wgpu::hal::vulkan::PresentDamageRect {
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height,
})
.collect();
if let Some(hal) = unsafe { surface.as_hal::<wgpu::hal::vulkan::Api>() } {
hal.set_next_present_damage(®ions);
return true;
}
}
let _ = (surface, damage);
false
}