mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-16 17:02:32 +00:00
Merge #124
124: Configure Swapchain with supported composite_alpha r=kvark a=silphendio CompositeAlpha::Inherit (default) is not supported on every graphics card. Relevant : https://github.com/gfx-rs/gfx/issues/2507 Co-authored-by: Markus Ginthör <markus.ginthoer@gmx.at>
This commit is contained in:
commit
4431df63d8
@ -1534,7 +1534,7 @@ pub fn device_create_swap_chain(
|
|||||||
let mut surface_guard = HUB.surfaces.write();
|
let mut surface_guard = HUB.surfaces.write();
|
||||||
let surface = &mut surface_guard[surface_id];
|
let surface = &mut surface_guard[surface_id];
|
||||||
|
|
||||||
let (caps, formats, _present_modes, _composite_alphas) = {
|
let (caps, formats, _present_modes, composite_alphas) = {
|
||||||
let adapter_guard = HUB.adapters.read();
|
let adapter_guard = HUB.adapters.read();
|
||||||
let adapter = &adapter_guard[device.adapter_id];
|
let adapter = &adapter_guard[device.adapter_id];
|
||||||
assert!(surface
|
assert!(surface
|
||||||
@ -1544,12 +1544,13 @@ pub fn device_create_swap_chain(
|
|||||||
};
|
};
|
||||||
let num_frames = caps.image_count.start; //TODO: configure?
|
let num_frames = caps.image_count.start; //TODO: configure?
|
||||||
let usage = conv::map_texture_usage(desc.usage, hal::format::Aspects::COLOR);
|
let usage = conv::map_texture_usage(desc.usage, hal::format::Aspects::COLOR);
|
||||||
let config = hal::SwapchainConfig::new(
|
let mut config = hal::SwapchainConfig::new(
|
||||||
desc.width,
|
desc.width,
|
||||||
desc.height,
|
desc.height,
|
||||||
conv::map_texture_format(desc.format),
|
conv::map_texture_format(desc.format),
|
||||||
num_frames, //TODO: configure?
|
num_frames, //TODO: configure?
|
||||||
);
|
);
|
||||||
|
config.composite_alpha = *composite_alphas.iter().next().unwrap();
|
||||||
|
|
||||||
if let Some(formats) = formats {
|
if let Some(formats) = formats {
|
||||||
assert!(
|
assert!(
|
||||||
|
Loading…
Reference in New Issue
Block a user