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 9ffe399
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 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_depth_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_stencil_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::Float { filterable: _ } => limits
.framebuffer_color_sample_counts
.min(limits.sampled_image_color_sample_counts),
wgt::TextureSampleType::Sint | wgt::TextureSampleType::Uint => {
limits.sampled_image_integer_sample_counts
}
_ => limits.storage_image_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
2 changes: 1 addition & 1 deletion wgpu/examples/msaa-line/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ impl framework::Example for Example {
config,
&shader,
&pipeline_layout,
sample_count,
4,
&vertex_buffer,
vertex_count,
);
Expand Down

0 comments on commit 9ffe399

Please sign in to comment.