Skip to content

Commit

Permalink
Follow the suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili committed Jan 27, 2023
1 parent 9eb6d19 commit b840635
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1493,23 +1493,26 @@ impl crate::Adapter<super::Api> for super::Adapter {
let format_aspect = crate::FormatAspects::from(format);
let limits = self.phd_capabilities.properties.limits;

let limits_counts = if format_aspect.contains(crate::FormatAspects::DEPTH) {
limits.sampled_image_depth_sample_counts
let sample_flags = if format_aspect.contains(crate::FormatAspects::DEPTH) {
limits
.framebuffer_color_sample_counts
.min(limits.sampled_image_depth_sample_counts)
} else if format_aspect.contains(crate::FormatAspects::STENCIL) {
limits.sampled_image_stencil_sample_counts
limits
.framebuffer_color_sample_counts
.min(limits.sampled_image_stencil_sample_counts)
} else {
match format.describe().sample_type {
wgt::TextureSampleType::Float { filterable: _ } => {
limits.sampled_image_color_sample_counts
}
wgt::TextureSampleType::Sint | wgt::TextureSampleType::Uint => {
limits.sampled_image_integer_sample_counts
}
_ => limits.storage_image_sample_counts,
wgt::TextureSampleType::Float { filterable: _ } => limits
.framebuffer_color_sample_counts
.min(limits.sampled_image_color_sample_counts),
wgt::TextureSampleType::Sint | wgt::TextureSampleType::Uint => limits
.framebuffer_color_sample_counts
.min(limits.sampled_image_integer_sample_counts),
_ => unimplemented!(),
}
};

let sample_flags = limits.framebuffer_color_sample_counts.min(limits_counts);
flags.set(
Tfc::MULTISAMPLE_X2,
sample_flags.contains(vk::SampleCountFlags::TYPE_2),
Expand Down

0 comments on commit b840635

Please sign in to comment.