Fix warnings for unrecognized Vulkan present mode (#7850)

This commit is contained in:
Andreas Reich 2025-06-26 15:33:20 +02:00 committed by GitHub
parent 995efddc62
commit 12808193fe
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 12 deletions

View File

@ -89,6 +89,7 @@ Bottom level categories:
#### Vulkan #### Vulkan
- Fix OpenBSD compilation of `wgpu_hal::vulkan::drm`. By @ErichDonGubler in [#7810](https://github.com/gfx-rs/wgpu/pull/7810). - Fix OpenBSD compilation of `wgpu_hal::vulkan::drm`. By @ErichDonGubler in [#7810](https://github.com/gfx-rs/wgpu/pull/7810).
- Fix warnings for unrecognized present mode. By @Wumpf in [#7850](https://github.com/gfx-rs/wgpu/pull/7850).
#### Metal #### Metal

1
Cargo.lock generated
View File

@ -5011,7 +5011,6 @@ dependencies = [
"naga", "naga",
"ndk-sys 0.6.0+11769913", "ndk-sys 0.6.0+11769913",
"objc", "objc",
"once_cell",
"ordered-float 5.0.0", "ordered-float 5.0.0",
"parking_lot", "parking_lot",
"portable-atomic", "portable-atomic",

View File

@ -468,17 +468,25 @@ pub fn map_present_mode(mode: wgt::PresentMode) -> vk::PresentModeKHR {
} }
pub fn map_vk_present_mode(mode: vk::PresentModeKHR) -> Option<wgt::PresentMode> { pub fn map_vk_present_mode(mode: vk::PresentModeKHR) -> Option<wgt::PresentMode> {
if mode == vk::PresentModeKHR::IMMEDIATE { // Not exposed in Ash yet.
Some(wgt::PresentMode::Immediate) const FIFO_LATEST_READY: vk::PresentModeKHR = vk::PresentModeKHR::from_raw(1_000_361_000);
} else if mode == vk::PresentModeKHR::MAILBOX {
Some(wgt::PresentMode::Mailbox) // See https://registry.khronos.org/vulkan/specs/latest/man/html/VkPresentModeKHR.html
} else if mode == vk::PresentModeKHR::FIFO { match mode {
Some(wgt::PresentMode::Fifo) vk::PresentModeKHR::IMMEDIATE => Some(wgt::PresentMode::Immediate),
} else if mode == vk::PresentModeKHR::FIFO_RELAXED { vk::PresentModeKHR::MAILBOX => Some(wgt::PresentMode::Mailbox),
Some(wgt::PresentMode::FifoRelaxed) vk::PresentModeKHR::FIFO => Some(wgt::PresentMode::Fifo),
} else { vk::PresentModeKHR::FIFO_RELAXED => Some(wgt::PresentMode::FifoRelaxed),
log::warn!("Unrecognized present mode {:?}", mode);
None // Modes that aren't exposed yet.
vk::PresentModeKHR::SHARED_DEMAND_REFRESH => None,
vk::PresentModeKHR::SHARED_CONTINUOUS_REFRESH => None,
FIFO_LATEST_READY => None,
_ => {
log::debug!("Unrecognized present mode {:?}", mode);
None
}
} }
} }