mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
Fix the default lod_max_clamp value for the SamplerDescriptor
The current default value for the lod_max_clamp of a sampler is 0. This would deactivate mipmapping alltogether. Setting it to f32::MAX makes sure to always enable it. It's the default value apple uses in Metal, it seems to be valid usage in Vulkan (maxLod in VkSamplerCreateInfo) and in DX12 (MaxLOD in D3D12_SAMPLER_DESC).
This commit is contained in:
parent
75d2e47849
commit
1f5a55ea13
@ -1474,7 +1474,7 @@ impl Default for FilterMode {
|
||||
}
|
||||
|
||||
/// Describes a [`Sampler`]
|
||||
#[derive(Default, Clone, Debug, PartialEq)]
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
#[cfg_attr(feature = "trace", derive(Serialize))]
|
||||
#[cfg_attr(feature = "replay", derive(Deserialize))]
|
||||
pub struct SamplerDescriptor<L> {
|
||||
@ -1507,6 +1507,25 @@ pub struct SamplerDescriptor<L> {
|
||||
pub _non_exhaustive: NonExhaustive,
|
||||
}
|
||||
|
||||
impl<L: Default> Default for SamplerDescriptor<L> {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
label: Default::default(),
|
||||
address_mode_u: Default::default(),
|
||||
address_mode_v: Default::default(),
|
||||
address_mode_w: Default::default(),
|
||||
mag_filter: Default::default(),
|
||||
min_filter: Default::default(),
|
||||
mipmap_filter: Default::default(),
|
||||
lod_min_clamp: 0.0,
|
||||
lod_max_clamp: f32::MAX,
|
||||
compare: Default::default(),
|
||||
anisotropy_clamp: Default::default(),
|
||||
_non_exhaustive: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<L> SamplerDescriptor<L> {
|
||||
pub fn map_label<K>(&self, fun: impl FnOnce(&L) -> K) -> SamplerDescriptor<K> {
|
||||
SamplerDescriptor {
|
||||
|
Loading…
Reference in New Issue
Block a user