mirror of
https://github.com/aljazceru/notedeck.git
synced 2026-02-23 09:24:20 +01:00
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:
@@ -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;
|
||||
|
||||
@@ -30,3 +30,6 @@ impl AnimationMode {
|
||||
!matches!(self, Self::NoAnimation)
|
||||
}
|
||||
}
|
||||
|
||||
// max size wgpu can handle without panicing
|
||||
pub const MAX_SIZE_WGPU: usize = 8192;
|
||||
|
||||
Reference in New Issue
Block a user