Reduced the time that panels are locked for the renderer.

This commit is contained in:
Filipe Rodrigues 2025-09-14 09:58:08 +01:00
parent 6ffd8ad9a2
commit a06a826bfa
Signed by: zenithsiz
SSH Key Fingerprint: SHA256:Mb5ppb3Sh7IarBO/sBTXLHbYEOz37hJAlslLQPPAPaU
2 changed files with 5 additions and 6 deletions

View File

@ -312,7 +312,7 @@ async fn renderer(
&wgpu_renderer,
&shared.wgpu,
&shared.panels_renderer_shared,
&mut shared.panels.get_all().await,
&shared.panels,
window,
window_geometry,
)

View File

@ -10,16 +10,15 @@ pub use self::{uniform::MAX_UNIFORM_SIZE, vertex::PanelVertex};
// Imports
use {
self::uniform::PanelImageUniforms,
super::{Panel, PanelFadeImage, PanelGeometryUniforms, PanelState},
super::{PanelFadeImage, PanelGeometryUniforms, PanelState, Panels},
crate::panel::PanelGeometry,
app_error::Context,
cgmath::Vector2,
std::sync::OnceLock,
itertools::Itertools,
std::{
borrow::Cow,
collections::{HashMap, hash_map},
sync::Arc,
sync::{Arc, OnceLock},
},
tokio::sync::Mutex,
wgpu::util::DeviceExt,
@ -115,7 +114,7 @@ impl PanelsRenderer {
wgpu_renderer: &WgpuRenderer,
wgpu: &Wgpu,
shared: &PanelsRendererShared,
panels: &mut [Panel],
panels: &Panels,
window: &Window,
window_geometry: Rect<i32, u32>,
) -> Result<(), AppError> {
@ -163,7 +162,7 @@ impl PanelsRenderer {
render_pass.set_index_buffer(shared.indices.slice(..), wgpu::IndexFormat::Uint32);
render_pass.set_vertex_buffer(0, shared.vertices.slice(..));
for panel in panels {
for panel in &mut *panels.get_all().await {
// Update the panel before drawing it
#[expect(clippy::match_same_arms, reason = "We'll be changing them soon")]
match &mut panel.state {