From 314a2e3944aa490938f422106b0f2ad1a61228cd Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sun, 19 Jan 2025 17:03:08 +0100 Subject: client: fix gpu size misscalculation --- client/src/renderer.rs | 3 ++- client/src/scene_prepare.rs | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'client/src') diff --git a/client/src/renderer.rs b/client/src/renderer.rs index 6a37320..2684ed0 100644 --- a/client/src/renderer.rs +++ b/client/src/renderer.rs @@ -119,7 +119,8 @@ impl<'a> Renderer<'a> { }); let depth = depth.create_view(&TextureViewDescriptor::default()); - for _ in 0..2 { + // TODO multithreading introduces double-loading some resources. fix that before increasing thread count + for _ in 0..1 { let scene_prepare = scene_prepare.clone(); let downloader = downloader.clone(); spawn(move || { diff --git a/client/src/scene_prepare.rs b/client/src/scene_prepare.rs index ad0f5e4..97ab166 100644 --- a/client/src/scene_prepare.rs +++ b/client/src/scene_prepare.rs @@ -181,7 +181,7 @@ impl ScenePreparer { self.index_buffers.insert( pres.clone(), (Arc::new(buffer), (buf.len() * 3) as u32), - buf.len(), + buf.len() * size_of::() * 3, ); debug!( "index buffer created (len={}, took {:?}) {pres}", @@ -199,8 +199,11 @@ impl ScenePreparer { label: Some("vertex attribute"), usage: BufferUsages::VERTEX | BufferUsages::COPY_DST, }); - self.vertex_buffers - .insert(pres.clone(), Arc::new(buffer), buf.len()); + self.vertex_buffers.insert( + pres.clone(), + Arc::new(buffer), + buf.len() * size_of::(), + ); debug!( "vertex attribute buffer created (len={}, took {:?}) {pres}", buf.len() / size_of::(), -- cgit v1.2.3-70-g09d2