mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Revert fake "memory leak" fix.
This commit is contained in:
parent
1dc6757668
commit
7b1c62acf7
@ -1387,23 +1387,6 @@ impl/*<V: RectRasterableVol>*/ Terrain<V> {
|
|||||||
let pos = response.pos;
|
let pos = response.pos;
|
||||||
let response_started_tick = response.started_tick;
|
let response_started_tick = response.started_tick;
|
||||||
|
|
||||||
// Working around a wgpu bug that tends to leak memory by doing this here, rather than
|
|
||||||
// only if we need to use the mapped buffers...
|
|
||||||
|
|
||||||
// Unmap buffers mapped on other threads (we do this here to avoid
|
|
||||||
// contention with queue submission, as both of these take the device write
|
|
||||||
// lock as of wgpu 0.8.1).
|
|
||||||
//
|
|
||||||
// FIXME: When we upgrade wgpu, reconsider all this.
|
|
||||||
renderer.unmap_instances(&mut response.sprite_instances.1);
|
|
||||||
if let Some(mesh) = &mut response.mesh {
|
|
||||||
let (tex, _) = &mut mesh.col_lights_info;
|
|
||||||
let mut tex = tex.as_mut().expect("The mesh exists, so the texture should too.");
|
|
||||||
mesh.opaque_model.as_mut().map(|model| renderer.unmap_model(model));
|
|
||||||
mesh.fluid_model.as_mut().map(|model| renderer.unmap_model(model));
|
|
||||||
renderer.unmap_model(&mut tex);
|
|
||||||
}
|
|
||||||
|
|
||||||
match self.mesh_todo.get(&pos) {
|
match self.mesh_todo.get(&pos) {
|
||||||
// It's the mesh we want, insert the newly finished model into the terrain model
|
// It's the mesh we want, insert the newly finished model into the terrain model
|
||||||
// data structure (convert the mesh to a model first of course).
|
// data structure (convert the mesh to a model first of course).
|
||||||
@ -1469,6 +1452,16 @@ impl/*<V: RectRasterableVol>*/ Terrain<V> {
|
|||||||
.expect("Chunk data does not fit in a texture of maximum size.")
|
.expect("Chunk data does not fit in a texture of maximum size.")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Unmap buffers mapped on other threads (we do this here to avoid
|
||||||
|
// contention with queue submission, as both of these take the device write
|
||||||
|
// lock as of wgpu 0.8.1).
|
||||||
|
//
|
||||||
|
// FIXME: When we upgrade wgpu, reconsider all this.
|
||||||
|
renderer.unmap_instances(&mut response.sprite_instances.1);
|
||||||
|
mesh.opaque_model.as_mut().map(|model| renderer.unmap_model(model));
|
||||||
|
mesh.fluid_model.as_mut().map(|model| renderer.unmap_model(model));
|
||||||
|
renderer.unmap_model(&mut tex);
|
||||||
|
|
||||||
// NOTE: Cast is safe since the origin was a u16.
|
// NOTE: Cast is safe since the origin was a u16.
|
||||||
let atlas_offs = Vec2::new(
|
let atlas_offs = Vec2::new(
|
||||||
allocation.rectangle.min.x as u32,
|
allocation.rectangle.min.x as u32,
|
||||||
@ -1547,9 +1540,9 @@ impl/*<V: RectRasterableVol>*/ Terrain<V> {
|
|||||||
frustum_last_plane_index: 0,
|
frustum_last_plane_index: 0,
|
||||||
});
|
});
|
||||||
} else if let Some(chunk) = self.chunks.get_mut(&pos) {
|
} else if let Some(chunk) = self.chunks.get_mut(&pos) {
|
||||||
/* // There was an update that didn't require a remesh (probably related to
|
// There was an update that didn't require a remesh (probably related to
|
||||||
// non-glowing sprites) so we just update those.
|
// non-glowing sprites) so we just update those.
|
||||||
renderer.unmap_instances(&mut response.sprite_instances.1); */
|
renderer.unmap_instances(&mut response.sprite_instances.1);
|
||||||
chunk.sprite_instances = response.sprite_instances;
|
chunk.sprite_instances = response.sprite_instances;
|
||||||
chunk.blocks_of_interest = response.blocks_of_interest;
|
chunk.blocks_of_interest = response.blocks_of_interest;
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user