From 0bb5b1d5a85b50db901004a9ea569a77738ee370 Mon Sep 17 00:00:00 2001 From: Torstein Grindvik Date: Sat, 25 Nov 2023 11:28:57 +0100 Subject: [PATCH] Use as_image_copy where possible Signed-off-by: Torstein Grindvik --- crates/bevy_pbr/src/render/mesh.rs | 7 +------ crates/bevy_sprite/src/mesh2d/mesh.rs | 7 +------ crates/bevy_sprite/src/render/mod.rs | 7 +------ 3 files changed, 3 insertions(+), 18 deletions(-) diff --git a/crates/bevy_pbr/src/render/mesh.rs b/crates/bevy_pbr/src/render/mesh.rs index 8c87d27129c2d..e99499665645a 100644 --- a/crates/bevy_pbr/src/render/mesh.rs +++ b/crates/bevy_pbr/src/render/mesh.rs @@ -377,12 +377,7 @@ impl FromWorld for MeshPipeline { let format_size = image.texture_descriptor.format.pixel_size(); render_queue.write_texture( - ImageCopyTexture { - texture: &texture, - mip_level: 0, - origin: Origin3d::ZERO, - aspect: TextureAspect::All, - }, + texture.as_image_copy(), &image.data, ImageDataLayout { offset: 0, diff --git a/crates/bevy_sprite/src/mesh2d/mesh.rs b/crates/bevy_sprite/src/mesh2d/mesh.rs index 9a63de7d2eaaf..3c0c69a85d510 100644 --- a/crates/bevy_sprite/src/mesh2d/mesh.rs +++ b/crates/bevy_sprite/src/mesh2d/mesh.rs @@ -304,12 +304,7 @@ impl FromWorld for Mesh2dPipeline { let format_size = image.texture_descriptor.format.pixel_size(); render_queue.write_texture( - ImageCopyTexture { - texture: &texture, - mip_level: 0, - origin: Origin3d::ZERO, - aspect: TextureAspect::All, - }, + texture.as_image_copy(), &image.data, ImageDataLayout { offset: 0, diff --git a/crates/bevy_sprite/src/render/mod.rs b/crates/bevy_sprite/src/render/mod.rs index 54048bfd448be..bea59a7aee298 100644 --- a/crates/bevy_sprite/src/render/mod.rs +++ b/crates/bevy_sprite/src/render/mod.rs @@ -100,12 +100,7 @@ impl FromWorld for SpritePipeline { let format_size = image.texture_descriptor.format.pixel_size(); render_queue.write_texture( - ImageCopyTexture { - texture: &texture, - mip_level: 0, - origin: Origin3d::ZERO, - aspect: TextureAspect::All, - }, + texture.as_image_copy(), &image.data, ImageDataLayout { offset: 0,