mirror of
https://github.com/gfx-rs/wgpu.git
synced 2024-11-22 14:55:05 +00:00
Merge #741
741: Fix the default lod_max_clamp value for the SamplerDescriptor r=kvark a=hasenbanck **Connections** As suggested in https://github.com/gfx-rs/wgpu-rs/pull/397 **Description** The current default value for the ```lod_max_clamp``` of a sampler is 0. This would deactivate mipmapping alltogether. Setting the default 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```). Co-authored-by: Nils Hasenbanck <nils@hasenbanck.de>
This commit is contained in:
commit
93a34b538d
@ -1431,7 +1431,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> {
|
||||
@ -1464,6 +1464,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