Skip to content

Commit 2bb8325

Browse files
committed
[vk] require VK_KHR_maintenance1 (in preparation for creating 2D texture views from slices of 3D textures)
1 parent d714e3d commit 2bb8325

File tree

3 files changed

+7
-27
lines changed

3 files changed

+7
-27
lines changed

wgpu-hal/src/vulkan/adapter.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use alloc::{borrow::ToOwned as _, collections::BTreeMap, sync::Arc, vec::Vec};
22
use core::ffi::CStr;
33

4-
use ash::{amd, ext, google, khr, vk};
4+
use ash::{ext, google, khr, vk};
55
use parking_lot::Mutex;
66

77
use super::conv;
@@ -943,13 +943,8 @@ impl PhysicalDeviceProperties {
943943
extensions.push(khr::swapchain::NAME);
944944

945945
if self.device_api_version < vk::API_VERSION_1_1 {
946-
// Require either `VK_KHR_maintenance1` or `VK_AMD_negative_viewport_height`
947-
if self.supports_extension(khr::maintenance1::NAME) {
948-
extensions.push(khr::maintenance1::NAME);
949-
} else {
950-
// `VK_AMD_negative_viewport_height` is obsoleted by `VK_KHR_maintenance1` and must not be enabled alongside it
951-
extensions.push(amd::negative_viewport_height::NAME);
952-
}
946+
// Require `VK_KHR_maintenance1`
947+
extensions.push(khr::maintenance1::NAME);
953948

954949
// Optional `VK_KHR_maintenance2`
955950
if self.supports_extension(khr::maintenance2::NAME) {
@@ -1638,12 +1633,11 @@ impl super::Instance {
16381633
);
16391634
return None;
16401635
}
1641-
if !phd_capabilities.supports_extension(amd::negative_viewport_height::NAME)
1642-
&& !phd_capabilities.supports_extension(khr::maintenance1::NAME)
1636+
if !phd_capabilities.supports_extension(khr::maintenance1::NAME)
16431637
&& phd_capabilities.device_api_version < vk::API_VERSION_1_1
16441638
{
16451639
log::warn!(
1646-
"viewport Y-flip is not supported, hiding adapter: {}",
1640+
"VK_KHR_maintenance1 is not supported, hiding adapter: {}",
16471641
info.name
16481642
);
16491643
return None;
@@ -1661,8 +1655,6 @@ impl super::Instance {
16611655
}
16621656

16631657
let private_caps = super::PrivateCapabilities {
1664-
flip_y_requires_shift: phd_capabilities.device_api_version >= vk::API_VERSION_1_1
1665-
|| phd_capabilities.supports_extension(khr::maintenance1::NAME),
16661658
imageless_framebuffers: match phd_features.imageless_framebuffer {
16671659
Some(features) => features.imageless_framebuffer == vk::TRUE,
16681660
None => phd_features

wgpu-hal/src/vulkan/command.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -788,11 +788,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
788788
};
789789
let vk_viewports = [vk::Viewport {
790790
x: 0.0,
791-
y: if self.device.private_caps.flip_y_requires_shift {
792-
desc.extent.height as f32
793-
} else {
794-
0.0
795-
},
791+
y: desc.extent.height as f32,
796792
width: desc.extent.width as f32,
797793
height: -(desc.extent.height as f32),
798794
min_depth: 0.0,
@@ -967,11 +963,7 @@ impl crate::CommandEncoder for super::CommandEncoder {
967963
unsafe fn set_viewport(&mut self, rect: &crate::Rect<f32>, depth_range: Range<f32>) {
968964
let vk_viewports = [vk::Viewport {
969965
x: rect.x,
970-
y: if self.device.private_caps.flip_y_requires_shift {
971-
rect.y + rect.h
972-
} else {
973-
rect.y
974-
},
966+
y: rect.y + rect.h,
975967
width: rect.w,
976968
height: -rect.h, // flip Y
977969
min_depth: depth_range.start,

wgpu-hal/src/vulkan/mod.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -488,10 +488,6 @@ struct RayTracingDeviceExtensionFunctions {
488488
/// device geometry, but affect the code paths taken internally.
489489
#[derive(Clone, Debug)]
490490
struct PrivateCapabilities {
491-
/// Y-flipping is implemented with either `VK_AMD_negative_viewport_height` or `VK_KHR_maintenance1`/1.1+. The AMD extension for negative viewport height does not require a Y shift.
492-
///
493-
/// This flag is `true` if the device has `VK_KHR_maintenance1`/1.1+ and `false` otherwise (i.e. in the case of `VK_AMD_negative_viewport_height`).
494-
flip_y_requires_shift: bool,
495491
imageless_framebuffers: bool,
496492
image_view_usage: bool,
497493
timeline_semaphores: bool,

0 commit comments

Comments
 (0)