Skip to content

Commit

Permalink
Add MULTISAMPLED_SHADING downlevel flag (#2425)
Browse files Browse the repository at this point in the history
* Fix msaa-line example's unnecessary MSAA data store

* Add MULTISAMPLED_SHADING downlevel flag
  • Loading branch information
jinleili authored Jan 28, 2022
1 parent b190003 commit 9cff141
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
12 changes: 4 additions & 8 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ impl PhysicalDeviceFeatures {
core: vk::PhysicalDeviceFeatures::builder()
.robust_buffer_access(private_caps.robust_buffer_access)
.independent_blend(true)
.sample_rate_shading(true)
.sample_rate_shading(
downlevel_flags.contains(wgt::DownlevelFlags::MULTISAMPLED_SHADING),
)
.image_cube_array(
downlevel_flags.contains(wgt::DownlevelFlags::CUBE_ARRAY_TEXTURES),
)
Expand Down Expand Up @@ -342,6 +344,7 @@ impl PhysicalDeviceFeatures {
Df::FRAGMENT_WRITABLE_STORAGE,
self.core.fragment_stores_and_atomics != 0,
);
dl_flags.set(Df::MULTISAMPLED_SHADING, self.core.sample_rate_shading != 0);

features.set(
F::INDIRECT_FIRST_INSTANCE,
Expand Down Expand Up @@ -929,13 +932,6 @@ impl super::Instance {
);
return None;
}
if phd_features.core.sample_rate_shading == 0 {
log::warn!(
"sample_rate_shading feature is not supported, hiding adapter: {}",
info.name
);
return None;
}
if !phd_capabilities.supports_extension(vk::AmdNegativeViewportHeightFn::name())
&& !phd_capabilities.supports_extension(vk::KhrMaintenance1Fn::name())
&& phd_capabilities.properties.api_version < vk::API_VERSION_1_2
Expand Down
3 changes: 3 additions & 0 deletions wgpu-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -909,6 +909,9 @@ bitflags::bitflags! {

/// Supports storage buffers in fragment shaders.
const FRAGMENT_STORAGE = 1 << 12;

/// Supports sample shading and multisample interpolation.
const MULTISAMPLED_SHADING = 1 << 13;
}
}

Expand Down

0 comments on commit 9cff141

Please sign in to comment.