Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MULTISAMPLED_SHADING downlevel flag #2425

Merged
merged 3 commits into from
Jan 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
cwfitzgerald marked this conversation as resolved.
Show resolved Hide resolved

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