mirror of
https://github.com/bevyengine/bevy
synced 2024-11-10 07:04:33 +00:00
Use as_image_copy where possible (#10733)
# Objective `wgpu` has a helper method `texture.as_image_copy()` for a common pattern when making a default-like `ImageCopyTexture` from a texture. This is used in various places in Bevy for texture copy operations, but it was not used where `write_texture` is called. ## Solution - Replace struct `ImageCopyTexture` initialization with `texture.as_image_copy()` where appropriate Signed-off-by: Torstein Grindvik <torstein.grindvik@muybridge.com> Co-authored-by: Torstein Grindvik <torstein.grindvik@muybridge.com>
This commit is contained in:
parent
89d652ba3a
commit
4788315fd0
3 changed files with 3 additions and 18 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue