Skip to content

Commit

Permalink
vulkan: fix issues querying multiview support (#2934)
Browse files Browse the repository at this point in the history
  • Loading branch information
i509VCB authored Aug 2, 2022
1 parent e59c330 commit 8444fbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
27 changes: 9 additions & 18 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>,
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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))
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 8444fbe

Please sign in to comment.