perf: use cached alpha mode instead of calling surface.get_capabilities every time the window is redrawn
This commit is contained in:
parent
46c745be2c
commit
0f37c9922d
1 changed files with 1 additions and 16 deletions
|
|
@ -397,21 +397,6 @@ impl graphics::Compositor for Compositor {
|
||||||
width: u32,
|
width: u32,
|
||||||
height: 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(
|
surface.configure(
|
||||||
&self.engine.device,
|
&self.engine.device,
|
||||||
&wgpu::SurfaceConfiguration {
|
&wgpu::SurfaceConfiguration {
|
||||||
|
|
@ -420,7 +405,7 @@ impl graphics::Compositor for Compositor {
|
||||||
present_mode: self.settings.present_mode,
|
present_mode: self.settings.present_mode,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
alpha_mode,
|
alpha_mode: self.alpha_mode,
|
||||||
view_formats: vec![],
|
view_formats: vec![],
|
||||||
desired_maximum_frame_latency: 1,
|
desired_maximum_frame_latency: 1,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue