Skip to content

Commit

Permalink
Use cached alpha mode instead of calling surface.get_capabilities eve…
Browse files Browse the repository at this point in the history
…ry time the window is redrawn
  • Loading branch information
Adam-Cosner committed Jan 15, 2025
1 parent 82b87f9 commit f4369fd
Showing 1 changed file with 1 addition and 16 deletions.
17 changes: 1 addition & 16 deletions wgpu/src/window/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,21 +402,6 @@ impl graphics::Compositor for Compositor {
width: u32,
height: u32,
) {
let caps = surface.get_capabilities(&self.adapter);
let alpha_mode = if caps
.alpha_modes
.contains(&wgpu::CompositeAlphaMode::PostMultiplied)
{
wgpu::CompositeAlphaMode::PostMultiplied
} else if caps
.alpha_modes
.contains(&wgpu::CompositeAlphaMode::PreMultiplied)
{
wgpu::CompositeAlphaMode::PreMultiplied
} else {
wgpu::CompositeAlphaMode::Auto
};

surface.configure(
&self.device,
&wgpu::SurfaceConfiguration {
Expand All @@ -425,7 +410,7 @@ impl graphics::Compositor for Compositor {
present_mode: self.settings.present_mode,
width,
height,
alpha_mode,
alpha_mode: self.alpha_mode,
view_formats: vec![],
desired_maximum_frame_latency: 1,
},
Expand Down

0 comments on commit f4369fd

Please sign in to comment.