From 7eb7efca7eaf06e64897e61f7abb7b719b32bac7 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 61416694727a1..0b1a20cc89095 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![1; 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,