You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was playing around with the headless_renderer.rs example. I observed that image_data received in the update system was 4x the size I was expecting. I set the dimensions to 64x64 in AppConfig; image_data.len was 65k bytes vs the expected 16k.
I think it's due how the cpu buffer is initialized in ImageCopier::new()
pub fn new(
src_image: Handle<Image>,
size: Extent3d,
render_device: &RenderDevice,
) -> ImageCopier {
let padded_bytes_per_row =
RenderDevice::align_copy_bytes_per_row((size.width) as usize) * 4; // HERE: shouldn't we multiply by 4 before calling align_copy_bytes_per_row?
let cpu_buffer = render_device.create_buffer(&BufferDescriptor {
label: None,
size: padded_bytes_per_row as u64 * size.height as u64,
usage: BufferUsages::MAP_READ | BufferUsages::COPY_DST,
mapped_at_creation: false,
});
ImageCopier {
buffer: cpu_buffer,
src_image,
enabled: Arc::new(AtomicBool::new(true)),
}
}
When I make the suggested change, I get the expected image_data length.
I'm relatively new to rendering code, so wanted to confirm this is an error first. If it is, I can submit a simple PR to fix.
The text was updated successfully, but these errors were encountered:
I was playing around with the headless_renderer.rs example. I observed that
image_data
received in the update system was 4x the size I was expecting. I set the dimensions to 64x64 in AppConfig; image_data.len was 65k bytes vs the expected 16k.I think it's due how the cpu buffer is initialized in ImageCopier::new()
When I make the suggested change, I get the expected image_data length.
I'm relatively new to rendering code, so wanted to confirm this is an error first. If it is, I can submit a simple PR to fix.
The text was updated successfully, but these errors were encountered: