Fix Metal Mipmap Behvior (#3610)
This commit is contained in:
Connor Fitzgerald 2023-03-22 17:30:41 -04:00 committed by GitHub
parent 63ede074d1
commit 4139175fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 14 deletions

View File

@ -39,13 +39,15 @@ Bottom level categories:
--> -->
## Unreleased ## Unreleased
## v0.15.3 (2023-03-22)
### Bug Fixes ### 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 #### 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) - 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)
### Bug Fixes
#### GLES
- Reset all queue state between command buffers in a submit. By @jleibs [#3589](https://github.com/gfx-rs/wgpu/pull/3589) - 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) - Reset the state of `SAMPLE_ALPHA_TO_COVERAGE` on queue reset. By @jleibs [#3589](https://github.com/gfx-rs/wgpu/pull/3589)

2
Cargo.lock generated
View File

@ -3017,7 +3017,7 @@ dependencies = [
[[package]] [[package]]
name = "wgpu-hal" name = "wgpu-hal"
version = "0.15.3" version = "0.15.4"
dependencies = [ dependencies = [
"android_system_properties", "android_system_properties",
"arrayvec 0.7.2", "arrayvec 0.7.2",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "wgpu-hal" name = "wgpu-hal"
version = "0.15.3" version = "0.15.4"
authors = ["wgpu developers"] authors = ["wgpu developers"]
edition = "2021" edition = "2021"
description = "WebGPU hardware abstraction layer" description = "WebGPU hardware abstraction layer"

View File

@ -537,7 +537,6 @@ impl super::PrivateCapabilities {
MUTABLE_COMPARISON_SAMPLER_SUPPORT, MUTABLE_COMPARISON_SAMPLER_SUPPORT,
), ),
sampler_clamp_to_border: Self::supports_any(device, SAMPLER_CLAMP_TO_BORDER_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_instance: Self::supports_any(device, BASE_INSTANCE_SUPPORT),
base_vertex_instance_drawing: Self::supports_any(device, BASE_VERTEX_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), dual_source_blending: Self::supports_any(device, DUAL_SOURCE_BLEND_SUPPORT),

View File

@ -407,14 +407,13 @@ impl crate::Device<super::Api> for super::Device {
&self, &self,
desc: &crate::SamplerDescriptor, desc: &crate::SamplerDescriptor,
) -> DeviceResult<super::Sampler> { ) -> DeviceResult<super::Sampler> {
let caps = &self.shared.private_caps;
objc::rc::autoreleasepool(|| { objc::rc::autoreleasepool(|| {
let descriptor = mtl::SamplerDescriptor::new(); let descriptor = mtl::SamplerDescriptor::new();
descriptor.set_min_filter(conv::map_filter_mode(desc.min_filter)); descriptor.set_min_filter(conv::map_filter_mode(desc.min_filter));
descriptor.set_mag_filter(conv::map_filter_mode(desc.mag_filter)); descriptor.set_mag_filter(conv::map_filter_mode(desc.mag_filter));
descriptor.set_mip_filter(match desc.mipmap_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 mtl::MTLSamplerMipFilter::NotMipmapped
} }
wgt::FilterMode::Nearest => mtl::MTLSamplerMipFilter::Nearest, wgt::FilterMode::Nearest => mtl::MTLSamplerMipFilter::Nearest,
@ -435,10 +434,6 @@ impl crate::Device<super::Api> for super::Device {
descriptor.set_lod_max_clamp(range.end); descriptor.set_lod_max_clamp(range.end);
} }
if caps.sampler_lod_average {
descriptor.set_lod_average(true); // optimization
}
if let Some(fun) = desc.compare { if let Some(fun) = desc.compare {
descriptor.set_compare_function(conv::map_compare_function(fun)); descriptor.set_compare_function(conv::map_compare_function(fun));
} }

View File

@ -151,7 +151,6 @@ struct PrivateCapabilities {
shared_textures: bool, shared_textures: bool,
mutable_comparison_samplers: bool, mutable_comparison_samplers: bool,
sampler_clamp_to_border: bool, sampler_clamp_to_border: bool,
sampler_lod_average: bool,
base_instance: bool, base_instance: bool,
base_vertex_instance_drawing: bool, base_vertex_instance_drawing: bool,
dual_source_blending: bool, dual_source_blending: bool,