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

Improve vk format msaa capabilities detection #3429

Merged
merged 4 commits into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ Bottom level categories:

- Implement `CommandEncoder::clear_buffer`. By @raphlinus in [#3426](https://github.com/gfx-rs/wgpu/pull/3426)

#### Vulkan

- Improve format MSAA capabilities detection. By @jinleili in [#3429](https://github.com/gfx-rs/wgpu/pull/3429)

## wgpu-0.15.0 (2023-01-25)

### Major Changes
Expand Down
26 changes: 13 additions & 13 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,22 +1493,23 @@ impl crate::Adapter<super::Api> for super::Adapter {
let format_aspect = crate::FormatAspects::from(format);
let limits = self.phd_capabilities.properties.limits;

let sample_flags = if format_aspect.contains(crate::FormatAspects::DEPTH) {
limits
.framebuffer_depth_sample_counts
.min(limits.sampled_image_depth_sample_counts)
let limits_counts = if format_aspect.contains(crate::FormatAspects::DEPTH) {
limits.sampled_image_depth_sample_counts
} else if format_aspect.contains(crate::FormatAspects::STENCIL) {
limits
.framebuffer_stencil_sample_counts
.min(limits.sampled_image_stencil_sample_counts)
limits.sampled_image_stencil_sample_counts
jinleili marked this conversation as resolved.
Show resolved Hide resolved
} else {
limits
.framebuffer_color_sample_counts
.min(limits.sampled_image_color_sample_counts)
.min(limits.sampled_image_integer_sample_counts)
.min(limits.storage_image_sample_counts)
match format.describe().sample_type {
wgt::TextureSampleType::Float { filterable: _ } => {
limits.sampled_image_color_sample_counts
jinleili marked this conversation as resolved.
Show resolved Hide resolved
}
wgt::TextureSampleType::Sint | wgt::TextureSampleType::Uint => {
limits.sampled_image_integer_sample_counts
}
_ => limits.storage_image_sample_counts,
jinleili marked this conversation as resolved.
Show resolved Hide resolved
}
};

let sample_flags = limits.framebuffer_color_sample_counts.min(limits_counts);
jinleili marked this conversation as resolved.
Show resolved Hide resolved
flags.set(
Tfc::MULTISAMPLE_X2,
sample_flags.contains(vk::SampleCountFlags::TYPE_2),
Expand All @@ -1517,7 +1518,6 @@ impl crate::Adapter<super::Api> for super::Adapter {
Tfc::MULTISAMPLE_X4,
sample_flags.contains(vk::SampleCountFlags::TYPE_4),
);

flags.set(
Tfc::MULTISAMPLE_X8,
sample_flags.contains(vk::SampleCountFlags::TYPE_8),
Expand Down