Skip to content

Commit

Permalink
impl Default for SurfaceConfiguration, simplify the use of users.
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili committed Sep 18, 2022
1 parent b752c7d commit 9e5e2aa
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 12 additions & 0 deletions wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3085,6 +3085,18 @@ pub struct SurfaceConfiguration {
pub present_mode: PresentMode,
}

impl Default for SurfaceConfiguration {
fn default() -> Self {
Self {
usage: crate::TextureUsages::RENDER_ATTACHMENT,
format: TextureFormat::Bgra8UnormSrgb,
width: 0,
height: 0,
present_mode: PresentMode::Fifo,
}
}
}

/// Status of the recieved surface image.
#[repr(C)]
#[derive(Debug)]
Expand Down
4 changes: 1 addition & 3 deletions wgpu/examples/framework.rs
Original file line number Diff line number Diff line change
Expand Up @@ -539,11 +539,9 @@ pub fn test<E: Example>(mut params: FrameworkRefTest) {

let mut example = E::init(
&wgpu::SurfaceConfiguration {
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
format: wgpu::TextureFormat::Rgba8UnormSrgb,
width: params.width,
height: params.height,
present_mode: wgpu::PresentMode::Fifo,
..Default::default()
},
&ctx.adapter,
&ctx.device,
Expand Down

0 comments on commit 9e5e2aa

Please sign in to comment.