diff --git a/crates/victory-gpu/src/sampler.rs b/crates/victory-gpu/src/sampler.rs index 10bd209..2132273 100644 --- a/crates/victory-gpu/src/sampler.rs +++ b/crates/victory-gpu/src/sampler.rs @@ -29,7 +29,7 @@ struct Fields { impl Fields { fn host(&self) -> D3D12_SAMPLER_DESC { let linear = |f: u32| u32::from(f == 1 || f == 3); - let aniso = self.mag == 3 || self.min == 3; + let aniso = self.mag >= 2 || self.min >= 2; // The console compares when the instruction says so, with the // sampler's function; the host needs a comparison sampler for that. // A sampler given a real test (less ... greater-or-equal) is one; @@ -226,22 +226,4 @@ mod tests { ); assert_eq!(d.ComparisonFunc, D3D12_COMPARISON_FUNC_LESS_EQUAL); } - - #[test] - fn anisotropic_point_samplers_stay_point() { - let mut w = [0u32; 27]; - w[1] = 2; // anisotropic point mag - w[2] = 2; // anisotropic point min - w[3] = 1; // point mip - w[13] = 8; - let d = console(&w); - assert_eq!(d.Filter.0, 0x00); - assert_eq!(d.MaxAnisotropy, 1); - - w[1] = 3; // anisotropic bilinear mag - w[2] = 3; // anisotropic bilinear min - let d = console(&w); - assert_eq!(d.Filter.0, 0x55); - assert_eq!(d.MaxAnisotropy, 8); - } } diff --git a/crates/victory-shader/src/emit/sampler.rs b/crates/victory-shader/src/emit/sampler.rs index f5b12fb..ca010e5 100644 --- a/crates/victory-shader/src/emit/sampler.rs +++ b/crates/victory-shader/src/emit/sampler.rs @@ -58,7 +58,7 @@ impl StaticSampler { 2 => 3, _ => 0, }; - let filter = if mag == 3 || min == 3 { + let filter = if mag >= 2 || min >= 2 { 0x54 | u32::from(mip == 2) | reduction << 7 } else { (min & 1) << 4 | (mag & 1) << 2 | u32::from(mip == 2) | reduction << 7 @@ -148,13 +148,9 @@ mod tests { let s = StaticSampler::from_words([w0, 0x00FF_F000, w2, 0]); assert_eq!(s.filter, base | 1, "reduction={reduction} mip=2"); } - // Anisotropic point mag (2) with linear min (1) and point mip (1) stays point mag. + // Mixed anisotropic mag (2) with linear min (1) and point mip (1). let mixed = StaticSampler::from_words([0, 0, (1 << 26) | (1 << 22) | (2 << 20), 0]); - assert_eq!(mixed.filter, 0x10); - let aniso_point = StaticSampler::from_words([0, 0, (1 << 26) | (2 << 22) | (2 << 20), 0]); - assert_eq!(aniso_point.filter, 0x00); - let aniso_linear = StaticSampler::from_words([0, 0, (1 << 26) | (1 << 22) | (3 << 20), 0]); - assert_eq!(aniso_linear.filter, 0x54); + assert_eq!(mixed.filter, 0x54); } #[test]