vulkan: fix issues querying multiview support (#2934)

This commit is contained in:
i509VCB
2022-08-01 19:55:53 -05:00
committed by GitHub
parent e59c33046b
commit 8444fbe460
2 changed files with 13 additions and 18 deletions

View File

@@ -103,6 +103,10 @@ the same every time it is rendered, we now warn if it is missing.
- `DownlevelCapabilities::default()` now returns the `ANISOTROPIC_FILTERING` flag set to true so DX12 lists `ANISOTROPIC_FILTERING` as true again by @cwfitzgerald in [#2851](https://github.com/gfx-rs/wgpu/pull/2851)
- Properly query format features for UAV/SRV usages of depth formats by @cwfitzgerald in [#2856](https://github.com/gfx-rs/wgpu/pull/2856)
#### Vulkan
- Vulkan 1.0 drivers that support `VK_KHR_multiview` now properly report the `MULTIVIEW` feature as supported by @i509VCB in [#2934](https://github.com/gfx-rs/wgpu/pull/2934).
- Stop using `VkPhysicalDevice11Features` in Vulkan 1.1 which is confusingly provided in Vulkan 1.2 by @i509VCB in [#2934](https://github.com/gfx-rs/wgpu/pull/2934).
#### GLES
- Fix depth stencil texture format capability by @jinleili in [#2854](https://github.com/gfx-rs/wgpu/pull/2854)
- `get_texture_format_features` now only returns usages for formats it actually supports by @cwfitzgerald in [#2856](https://github.com/gfx-rs/wgpu/pull/2856)

View File

@@ -15,7 +15,6 @@ fn indexing_features() -> wgt::Features {
#[derive(Debug, Default)]
pub struct PhysicalDeviceFeatures {
core: vk::PhysicalDeviceFeatures,
vulkan_1_1: Option<vk::PhysicalDeviceVulkan11Features>,
pub(super) vulkan_1_2: Option<vk::PhysicalDeviceVulkan12Features>,
pub(super) descriptor_indexing: Option<vk::PhysicalDeviceDescriptorIndexingFeaturesEXT>,
imageless_framebuffer: Option<vk::PhysicalDeviceImagelessFramebufferFeaturesKHR>,
@@ -177,15 +176,6 @@ impl PhysicalDeviceFeatures {
//.shader_resource_residency(requested_features.contains(wgt::Features::SHADER_RESOURCE_RESIDENCY))
.geometry_shader(requested_features.contains(wgt::Features::SHADER_PRIMITIVE_INDEX))
.build(),
vulkan_1_1: if api_version >= vk::API_VERSION_1_1 {
Some(
vk::PhysicalDeviceVulkan11Features::builder()
.multiview(requested_features.contains(wgt::Features::MULTIVIEW))
.build(),
)
} else {
None
},
vulkan_1_2: if api_version >= vk::API_VERSION_1_2 {
Some(
vk::PhysicalDeviceVulkan12Features::builder()
@@ -316,7 +306,9 @@ impl PhysicalDeviceFeatures {
} else {
None
},
multiview: if enabled_extensions.contains(&vk::KhrMultiviewFn::name()) {
multiview: if api_version >= vk::API_VERSION_1_1
|| enabled_extensions.contains(&vk::KhrMultiviewFn::name())
{
Some(
vk::PhysicalDeviceMultiviewFeatures::builder()
.multiview(requested_features.contains(wgt::Features::MULTIVIEW))
@@ -451,10 +443,6 @@ impl PhysicalDeviceFeatures {
let intel_windows = caps.properties.vendor_id == db::intel::VENDOR && cfg!(windows);
if let Some(ref vulkan_1_1) = self.vulkan_1_1 {
features.set(F::MULTIVIEW, vulkan_1_1.multiview != 0);
}
if let Some(ref vulkan_1_2) = self.vulkan_1_2 {
const STORAGE: F = F::STORAGE_RESOURCE_BINDING_ARRAY;
if Self::all_features_supported(
@@ -891,10 +879,13 @@ impl super::InstanceShared {
let core = vk::PhysicalDeviceFeatures::default();
let mut builder = vk::PhysicalDeviceFeatures2KHR::builder().features(core);
if capabilities.properties.api_version >= vk::API_VERSION_1_1 {
// `VK_KHR_multiview` is promoted to 1.1
if capabilities.properties.api_version >= vk::API_VERSION_1_1
|| capabilities.supports_extension(vk::KhrMultiviewFn::name())
{
let next = features
.vulkan_1_1
.insert(vk::PhysicalDeviceVulkan11Features::default());
.multiview
.insert(vk::PhysicalDeviceMultiviewFeatures::default());
builder = builder.push_next(next);
}