Fix bug introduced by #2410 (#2411)

* Fix bug introduced by #2410

* Doc fix
This commit is contained in:
Rua 2023-11-17 17:14:33 +01:00 committed by GitHub
parent 144d025d2d
commit 795f02217a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -575,7 +575,8 @@ impl Swapchain {
present_mode: (device.enabled_extensions().ext_swapchain_maintenance1) present_mode: (device.enabled_extensions().ext_swapchain_maintenance1)
.then_some(present_mode), .then_some(present_mode),
full_screen_exclusive, full_screen_exclusive,
win32_monitor, win32_monitor: win32_monitor
.filter(|_| full_screen_exclusive != FullScreenExclusive::Default),
..Default::default() ..Default::default()
}, },
) )
@ -597,7 +598,11 @@ impl Swapchain {
present_mode: (device.enabled_extensions().ext_swapchain_maintenance1) present_mode: (device.enabled_extensions().ext_swapchain_maintenance1)
.then_some(present_mode), .then_some(present_mode),
full_screen_exclusive, full_screen_exclusive,
win32_monitor, win32_monitor: win32_monitor.filter(|_| {
surface.api() == SurfaceApi::Win32
&& full_screen_exclusive
== FullScreenExclusive::ApplicationControlled
}),
..Default::default() ..Default::default()
}, },
) )
@ -617,7 +622,11 @@ impl Swapchain {
surface, surface,
SurfaceInfo { SurfaceInfo {
full_screen_exclusive, full_screen_exclusive,
win32_monitor, win32_monitor: win32_monitor.filter(|_| {
surface.api() == SurfaceApi::Win32
&& full_screen_exclusive
== FullScreenExclusive::ApplicationControlled
}),
..Default::default() ..Default::default()
}, },
) )
@ -953,33 +962,6 @@ impl Swapchain {
*/ */
} }
if surface.api() == SurfaceApi::Win32
&& full_screen_exclusive == FullScreenExclusive::ApplicationControlled
{
if win32_monitor.is_none() {
return Err(Box::new(ValidationError {
problem: "`surface` is a Win32 surface, and \
`create_info.full_screen_exclusive` is \
`FullScreenExclusive::ApplicationControlled`, but \
`create_info.win32_monitor` is `None`"
.into(),
vuids: &["VUID-VkSwapchainCreateInfoKHR-pNext-02679"],
..Default::default()
}));
}
} else {
if win32_monitor.is_some() {
return Err(Box::new(ValidationError {
problem: "`surface` is not a Win32 surface, or \
`create_info.full_screen_exclusive` is not \
`FullScreenExclusive::ApplicationControlled`, but \
`create_info.win32_monitor` is `Some`"
.into(),
..Default::default()
}));
}
}
Ok(()) Ok(())
} }
@ -1952,9 +1934,8 @@ pub struct SwapchainCreateInfo {
/// The default value is [`FullScreenExclusive::Default`]. /// The default value is [`FullScreenExclusive::Default`].
pub full_screen_exclusive: FullScreenExclusive, pub full_screen_exclusive: FullScreenExclusive,
/// For Win32 surfaces, if `full_screen_exclusive` is /// If `full_screen_exclusive` is not [`FullScreenExclusive::Default`], this specifies the
/// [`FullScreenExclusive::ApplicationControlled`], this specifies the monitor on which /// monitor on which full-screen exclusivity should be used.
/// full-screen exclusivity should be used.
/// ///
/// For this case, the value must be `Some`, and for all others it must be `None`. /// For this case, the value must be `Some`, and for all others it must be `None`.
/// ///
@ -2011,7 +1992,7 @@ impl SwapchainCreateInfo {
scaling_behavior, scaling_behavior,
present_gravity, present_gravity,
full_screen_exclusive, full_screen_exclusive,
win32_monitor: _, win32_monitor,
_ne: _, _ne: _,
} = self; } = self;
@ -2315,6 +2296,23 @@ impl SwapchainCreateInfo {
"VUID-VkSurfaceFullScreenExclusiveInfoEXT-fullScreenExclusive-parameter", "VUID-VkSurfaceFullScreenExclusiveInfoEXT-fullScreenExclusive-parameter",
]) ])
})?; })?;
if win32_monitor.is_none() {
return Err(Box::new(ValidationError {
problem: "`full_screen_exclusive` is not `FullScreenExclusive::Default`, but \
`win32_monitor` is `None`"
.into(),
vuids: &["VUID-VkSwapchainCreateInfoKHR-pNext-02679"],
..Default::default()
}));
}
} else if win32_monitor.is_some() {
return Err(Box::new(ValidationError {
problem: "`full_screen_exclusive` is `FullScreenExclusive::Default`, but \
`win32_monitor` is `Some`"
.into(),
..Default::default()
}));
} }
Ok(()) Ok(())