Skip to content

Commit

Permalink
Fix Metal Mipmap Behvior (gfx-rs#3610)
Browse files Browse the repository at this point in the history
  • Loading branch information
cwfitzgerald committed Mar 22, 2023
1 parent 63ede07 commit 56941cc
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 12 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ Bottom level categories:
-->

## Unreleased
### Bug Fixes
#### GLES
- Fix `Vertex buffer is not big enough for the draw call.` for ANGLE/Web when rendering with instance attributes on a single instance. By @wumpf in [#3596](https://github.com/gfx-rs/wgpu/pull/3596)

## v0.15.3 (2023-03-22)
### Bug Fixes

#### Metal
- Fix incorrect mipmap being sampled when using `MinLod <= 0.0` and `MaxLod >= 32.0` or when the fragment shader samples different Lods in the same quad. By @cwfitzgerald in [#3610](https://github.com/gfx-rs/wgpu/pull/3610).

#### GLES
- Fix `Vertex buffer is not big enough for the draw call.` for ANGLE/Web when rendering with instance attributes on a single instance. By @wumpf in [#3596](https://github.com/gfx-rs/wgpu/pull/3596)
- Reset all queue state between command buffers in a submit. By @jleibs [#3589](https://github.com/gfx-rs/wgpu/pull/3589)
- Reset the state of `SAMPLE_ALPHA_TO_COVERAGE` on queue reset. By @jleibs [#3589](https://github.com/gfx-rs/wgpu/pull/3589)

Expand Down
1 change: 0 additions & 1 deletion wgpu-hal/src/metal/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,6 @@ impl super::PrivateCapabilities {
MUTABLE_COMPARISON_SAMPLER_SUPPORT,
),
sampler_clamp_to_border: Self::supports_any(device, SAMPLER_CLAMP_TO_BORDER_SUPPORT),
sampler_lod_average: { version.at_least((11, 0), (9, 0), os_is_mac) },
base_instance: Self::supports_any(device, BASE_INSTANCE_SUPPORT),
base_vertex_instance_drawing: Self::supports_any(device, BASE_VERTEX_INSTANCE_SUPPORT),
dual_source_blending: Self::supports_any(device, DUAL_SOURCE_BLEND_SUPPORT),
Expand Down
7 changes: 1 addition & 6 deletions wgpu-hal/src/metal/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -407,14 +407,13 @@ impl crate::Device<super::Api> for super::Device {
&self,
desc: &crate::SamplerDescriptor,
) -> DeviceResult<super::Sampler> {
let caps = &self.shared.private_caps;
objc::rc::autoreleasepool(|| {
let descriptor = mtl::SamplerDescriptor::new();

descriptor.set_min_filter(conv::map_filter_mode(desc.min_filter));
descriptor.set_mag_filter(conv::map_filter_mode(desc.mag_filter));
descriptor.set_mip_filter(match desc.mipmap_filter {
wgt::FilterMode::Nearest if desc.lod_clamp.is_none() => {
wgt::FilterMode::Nearest if desc.lod_clamp == Some(0.0..0.0) => {
mtl::MTLSamplerMipFilter::NotMipmapped
}
wgt::FilterMode::Nearest => mtl::MTLSamplerMipFilter::Nearest,
Expand All @@ -435,10 +434,6 @@ impl crate::Device<super::Api> for super::Device {
descriptor.set_lod_max_clamp(range.end);
}

if caps.sampler_lod_average {
descriptor.set_lod_average(true); // optimization
}

if let Some(fun) = desc.compare {
descriptor.set_compare_function(conv::map_compare_function(fun));
}
Expand Down
1 change: 0 additions & 1 deletion wgpu-hal/src/metal/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ struct PrivateCapabilities {
shared_textures: bool,
mutable_comparison_samplers: bool,
sampler_clamp_to_border: bool,
sampler_lod_average: bool,
base_instance: bool,
base_vertex_instance_drawing: bool,
dual_source_blending: bool,
Expand Down
1 change: 0 additions & 1 deletion wgpu-hal/src/vulkan/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1312,7 +1312,6 @@ impl super::Adapter {
},
vendor_id: self.phd_capabilities.properties.vendor_id,
timestamp_period: self.phd_capabilities.properties.limits.timestamp_period,
downlevel_flags: self.downlevel_flags,
private_caps: self.private_caps.clone(),
workarounds: self.workarounds,
render_passes: Mutex::new(Default::default()),
Expand Down

0 comments on commit 56941cc

Please sign in to comment.