From 48d70280eb4f5908f1c9339bebdfbab856d55ae1 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 26 Feb 2020 18:49:46 +0100 Subject: Fix multiple issues from the refactoring - Update texture view on grow - Fix atlas texture coordinates - Fix fragmented uploads --- wgpu/src/image.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'wgpu/src/image.rs') diff --git a/wgpu/src/image.rs b/wgpu/src/image.rs index afff52a6..1ffa50d2 100644 --- a/wgpu/src/image.rs +++ b/wgpu/src/image.rs @@ -319,6 +319,8 @@ impl Pipeline { let texture_version = self.texture_atlas.layer_count(); if self.texture_version != texture_version { + log::info!("Atlas has grown. Recreating bind group..."); + self.texture = device.create_bind_group(&wgpu::BindGroupDescriptor { layout: &self.texture_layout, @@ -525,12 +527,12 @@ fn add_instance( _position: position, _size: size, _position_in_atlas: [ - x as f32 / atlas::SIZE as f32, - y as f32 / atlas::SIZE as f32, + (x as f32 + 0.5) / atlas::SIZE as f32, + (y as f32 + 0.5) / atlas::SIZE as f32, ], _size_in_atlas: [ - width as f32 / atlas::SIZE as f32, - height as f32 / atlas::SIZE as f32, + (width as f32 - 0.5) / atlas::SIZE as f32, + (height as f32 - 0.5) / atlas::SIZE as f32, ], _layer: layer as u32, }; -- cgit