fix: crash on startup

```
wgpu error: Validation Error

Caused by:
  In Device::create_texture, label = 'egui_texid_Managed(65)'
    Dimension X value 10986 exceeds the limit of 8192
```

Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
kernelkind
2025-10-03 16:03:51 -04:00
parent 4c867f9fc2
commit b632d6fbc0
2 changed files with 17 additions and 1 deletions

View File

@@ -23,6 +23,19 @@ impl PixelDimensions {
y: (self.y as f32) / ppp,
}
}
pub fn clamp_wgpu(mut self) -> PixelDimensions {
let val = super::MAX_SIZE_WGPU as u32;
if self.x > val {
self.x = val;
}
if self.y > val {
self.y = val
}
self
}
}
#[derive(Clone, Debug)]
@@ -50,7 +63,7 @@ impl ImageMetadata {
ui: &egui::Ui,
available_points: PointDimensions,
) -> PixelDimensions {
let max_pixels = available_points.to_pixels(ui);
let max_pixels = available_points.to_pixels(ui).clamp_wgpu();
let Some(defined_dimensions) = &self.dimensions else {
return max_pixels;

View File

@@ -30,3 +30,6 @@ impl AnimationMode {
!matches!(self, Self::NoAnimation)
}
}
// max size wgpu can handle without panicing
pub const MAX_SIZE_WGPU: usize = 8192;