mirror of
https://github.com/bevyengine/bevy
synced 2024-11-22 04:33:37 +00:00
fix Default
implementation of Image
so that size and data match (#2833)
Before using this image resulted in an `Error in Queue::write_texture: copy of 0..4 would end up overrunning the bounds of the Source buffer of size 0`
This commit is contained in:
parent
52fd626fed
commit
1e03a97e73
1 changed files with 5 additions and 2 deletions
|
@ -3,6 +3,7 @@ use crate::{
|
|||
render_asset::RenderAsset,
|
||||
render_resource::{Sampler, Texture, TextureView},
|
||||
renderer::{RenderDevice, RenderQueue},
|
||||
texture::BevyDefault,
|
||||
};
|
||||
use bevy_reflect::TypeUuid;
|
||||
use thiserror::Error;
|
||||
|
@ -25,15 +26,17 @@ pub struct Image {
|
|||
|
||||
impl Default for Image {
|
||||
fn default() -> Self {
|
||||
let format = wgpu::TextureFormat::bevy_default();
|
||||
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,
|
||||
|
|
Loading…
Reference in a new issue