Skip to content

Commit 1d65643

Browse files
committed
[add] test to ensure that anisotropy becomes 1 when requested but filters remain non-linear
1 parent 33689dd commit 1d65643

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

crates/lambda-rs-platform/src/wgpu/texture.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,4 +1182,26 @@ mod tests {
11821182
16
11831183
);
11841184
}
1185+
1186+
#[test]
1187+
fn sampler_builder_anisotropy_is_disabled_when_filters_not_all_linear() {
1188+
// Default builder uses nearest filters, so anisotropy must be disabled.
1189+
assert_eq!(
1190+
SamplerBuilder::new()
1191+
.with_anisotropy_clamp(8)
1192+
.to_descriptor(16)
1193+
.anisotropy_clamp,
1194+
1
1195+
);
1196+
1197+
// If mipmap filtering isn't linear, anisotropy must be disabled.
1198+
assert_eq!(
1199+
SamplerBuilder::new()
1200+
.linear()
1201+
.with_anisotropy_clamp(8)
1202+
.to_descriptor(16)
1203+
.anisotropy_clamp,
1204+
1
1205+
);
1206+
}
11851207
}

0 commit comments

Comments
 (0)