Skip to content

Commit

Permalink
Add a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
nical committed Nov 7, 2022
1 parent 472b33d commit 2f41823
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
49 changes: 49 additions & 0 deletions wgpu/tests/queue_transfer.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//! Tests for buffer copy validation.
use std::num::NonZeroU32;

use crate::common::{fail, initialize_test, TestParameters};

#[test]
fn queue_write_texture_overflow() {
initialize_test(TestParameters::default(), |ctx| {
let texture = ctx.device.create_texture(&wgpu::TextureDescriptor {
label: None,
size: wgpu::Extent3d {
width: 146,
height: 25,
depth_or_array_layers: 192,
},
mip_level_count: 1,
sample_count: 1,
dimension: wgpu::TextureDimension::D2,
format: wgpu::TextureFormat::Rgba32Float,
usage: wgpu::TextureUsages::COPY_DST,
});

let data = vec![255; 128];

fail(&ctx.device, || {
ctx.queue.write_texture(
wgpu::ImageCopyTexture {
texture: &texture,
mip_level: 0,
origin: wgpu::Origin3d::ZERO,
aspect: wgpu::TextureAspect::All,
},
&data,
wgpu::ImageDataLayout {
offset: 0,
bytes_per_row: NonZeroU32::new(879161360),
//bytes_per_image: 4294967295,
rows_per_image: NonZeroU32::new(4294967295 / 879161360),
},
wgpu::Extent3d {
width: 3056263286,
height: 64,
depth_or_array_layers: 1144576469,
},
);
});
});
}
1 change: 1 addition & 0 deletions wgpu/tests/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod encoder;
mod example_wgsl;
mod instance;
mod poll;
mod queue_transfer;
mod resource_descriptor_accessor;
mod resource_error;
mod shader;
Expand Down

0 comments on commit 2f41823

Please sign in to comment.