Skip to content

Commit 26018bd

Browse files
committed
Fmt.
1 parent efa0101 commit 26018bd

File tree

3 files changed

+43
-17
lines changed

3 files changed

+43
-17
lines changed

crates/processing_render/src/graphics.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,7 @@ pub fn readback(
358358

359359
let texture = view_target.main_texture();
360360

361-
let mut encoder =
362-
render_device.create_command_encoder(&CommandEncoderDescriptor::default());
361+
let mut encoder = render_device.create_command_encoder(&CommandEncoderDescriptor::default());
363362

364363
let px_size = pixel_size(graphics.texture_format)?;
365364
let padded_bytes_per_row =
@@ -413,7 +412,15 @@ pub fn readback(
413412
}
414413

415414
pub fn update_region_write(
416-
In((entity, x, y, width, height, data, px_size)): In<(Entity, u32, u32, u32, u32, Vec<u8>, u32)>,
415+
In((entity, x, y, width, height, data, px_size)): In<(
416+
Entity,
417+
u32,
418+
u32,
419+
u32,
420+
u32,
421+
Vec<u8>,
422+
u32,
423+
)>,
417424
graphics_query: Query<&Graphics>,
418425
graphics_targets: Res<GraphicsTargets>,
419426
render_queue: Res<RenderQueue>,
@@ -437,11 +444,7 @@ pub fn update_region_write(
437444
let texture = view_target.main_texture();
438445
eprintln!(
439446
"update_region: writing to texture {:p} at ({}, {}) size {}x{}",
440-
texture as *const _,
441-
x,
442-
y,
443-
width,
444-
height
447+
texture as *const _, x, y, width, height
445448
);
446449
let bytes_per_row = width * px_size;
447450

@@ -479,7 +482,9 @@ pub fn prepare_update_region(
479482
if pixels.len() != expected_count {
480483
return Err(ProcessingError::InvalidArgument(format!(
481484
"Expected {} pixels for {}x{} region, got {}",
482-
expected_count, width, height,
485+
expected_count,
486+
width,
487+
height,
483488
pixels.len()
484489
)));
485490
}
@@ -493,7 +498,6 @@ pub fn prepare_update_region(
493498
Ok((data, px_size))
494499
}
495500

496-
497501
#[derive(Resource, Debug, Clone, Reflect)]
498502
pub struct RenderLayersManager {
499503
used: RenderLayers,

crates/processing_render/src/image.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,7 @@ pub fn readback(
209209
.get(&entity)
210210
.ok_or(ProcessingError::ImageNotFound)?;
211211

212-
let mut encoder =
213-
render_device.create_command_encoder(&CommandEncoderDescriptor::default());
212+
let mut encoder = render_device.create_command_encoder(&CommandEncoderDescriptor::default());
214213

215214
let px_size = pixel_size(p_image.texture_format)?;
216215
let padded_bytes_per_row =
@@ -269,7 +268,15 @@ pub fn readback(
269268
}
270269

271270
pub fn update_region_write(
272-
In((entity, x, y, width, height, data, px_size)): In<(Entity, u32, u32, u32, u32, Vec<u8>, u32)>,
271+
In((entity, x, y, width, height, data, px_size)): In<(
272+
Entity,
273+
u32,
274+
u32,
275+
u32,
276+
u32,
277+
Vec<u8>,
278+
u32,
279+
)>,
273280
p_images: Query<&Image>,
274281
p_image_textures: Res<ImageTextures>,
275282
render_queue: Res<RenderQueue>,
@@ -325,7 +332,9 @@ pub fn prepare_update_region(
325332
if pixels.len() != expected_count {
326333
return Err(ProcessingError::InvalidArgument(format!(
327334
"Expected {} pixels for {}x{} region, got {}",
328-
expected_count, width, height,
335+
expected_count,
336+
width,
337+
height,
329338
pixels.len()
330339
)));
331340
}

crates/processing_render/src/lib.rs

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -358,12 +358,25 @@ pub fn graphics_update(graphics_entity: Entity, pixels: &[LinearRgba]) -> error:
358358
.get::<graphics::Graphics>(graphics_entity)
359359
.ok_or(error::ProcessingError::GraphicsNotFound)?
360360
.size;
361-
let (data, px_size) =
362-
graphics::prepare_update_region(world, graphics_entity, size.width, size.height, pixels)?;
361+
let (data, px_size) = graphics::prepare_update_region(
362+
world,
363+
graphics_entity,
364+
size.width,
365+
size.height,
366+
pixels,
367+
)?;
363368
world
364369
.run_system_cached_with(
365370
graphics::update_region_write,
366-
(graphics_entity, 0, 0, size.width, size.height, data, px_size),
371+
(
372+
graphics_entity,
373+
0,
374+
0,
375+
size.width,
376+
size.height,
377+
data,
378+
px_size,
379+
),
367380
)
368381
.unwrap()
369382
})

0 commit comments

Comments
 (0)