From ee78688b3ce7daac5debb64967ec04d07b2254b0 Mon Sep 17 00:00:00 2001 From: Jakob Hellermann Date: Thu, 16 Sep 2021 13:45:41 +0200 Subject: [PATCH] fix Default implementation of Image so that size and data match --- pipelined/bevy_render2/src/texture/image.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pipelined/bevy_render2/src/texture/image.rs b/pipelined/bevy_render2/src/texture/image.rs index 61416694727a16..11c98f1b2b3c41 100644 --- a/pipelined/bevy_render2/src/texture/image.rs +++ b/pipelined/bevy_render2/src/texture/image.rs @@ -25,15 +25,17 @@ pub struct Image { impl Default for Image { fn default() -> Self { + let format = wgpu::TextureFormat::Rgba8UnormSrgb; + let data = vec![0; format.pixel_size() as usize]; Image { - data: Default::default(), + data, texture_descriptor: wgpu::TextureDescriptor { size: wgpu::Extent3d { width: 1, height: 1, depth_or_array_layers: 1, }, - format: wgpu::TextureFormat::Rgba8UnormSrgb, + format, dimension: wgpu::TextureDimension::D2, label: None, mip_level_count: 1,