summaryrefslogtreecommitdiffstats
path: root/wgpu/src/image
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--wgpu/src/image.rs10
-rw-r--r--wgpu/src/image/raster.rs5
2 files changed, 8 insertions, 7 deletions
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,
};
diff --git a/wgpu/src/image/raster.rs b/wgpu/src/image/raster.rs
index 8d2f342e..b19da582 100644
--- a/wgpu/src/image/raster.rs
+++ b/wgpu/src/image/raster.rs
@@ -83,10 +83,9 @@ impl Cache {
if let Memory::Host(image) = memory {
let (width, height) = image.dimensions();
- let allocation =
- atlas.upload(width, height, &image, device, encoder)?;
+ let entry = atlas.upload(width, height, &image, device, encoder)?;
- *memory = Memory::Device(allocation);
+ *memory = Memory::Device(entry);
}
if let Memory::Device(allocation) = memory {