Reduce alignment requirements.

This commit is contained in:
Joshua Yanovski 2022-08-15 19:50:44 -07:00
parent 54847c726b
commit d38ce95b22
2 changed files with 4 additions and 3 deletions

View File

@ -3,6 +3,7 @@
#![allow(clippy::identity_op, clippy::option_map_unit_fn)]
#![deny(clippy::clone_on_ref_ptr)]
#![feature(
array_chunks,
array_methods,
array_windows,
array_zip,

View File

@ -1354,8 +1354,7 @@ impl/*<V: RectRasterableVol>*/ Terrain<V> {
label: Some("Update textures."),
});
let locals_buffer_ = bytemuck::cast_slice_mut(&mut *locals_buffer);
for (locals_offset, (response, locals_buffer)) in incoming_chunks.zip(locals_buffer_).enumerate() {
for (locals_offset, (response, locals_buffer)) in incoming_chunks.zip(locals_buffer.array_chunks_mut::<{ core::mem::size_of::<TerrainLocals>() }>()).enumerate() {
match self.mesh_todo.get(&response.pos) {
// 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).
@ -1462,7 +1461,7 @@ impl/*<V: RectRasterableVol>*/ Terrain<V> {
);
// Update the memory mapped locals.
*locals_buffer =
let locals_buffer_ =
/* renderer.update_mapped(&mut mesh.locals, &[*/TerrainLocals::new(
Vec3::from(
response.pos.map2(VolGrid2d::<V>::chunk_size(), |e, sz| {
@ -1472,6 +1471,7 @@ impl/*<V: RectRasterableVol>*/ Terrain<V> {
atlas_offs,
load_time,
)/*])*/;
*locals_buffer = bytemuck::cast(locals_buffer_);
/* let locals = Arc::clone(&locals); */
Self::insert_chunk(&slowjob, &mut self.chunks, &mut self.atlas, response.pos, TerrainChunkData {