fix(naga msl-out): Support sampler lod_clamp & max_anisotropy (#9842)

This commit is contained in:
Jeffrey Vo authored and GitHub committed 2026-07-16 12:21:07 -04:00
1 parent 014d9e8481
commit de9f9f4de8
2 files changed
+19 -7

No files matched your search

+17 -7
View File
@@ -4957,6 +4957,7 @@ template <typename A>
&mut self,
level: back::Level,
sampler: &sm::InlineSampler,
options: &Options,
) -> BackendResult {
for (&letter, address) in ['s', 't', 'r'].iter().zip(sampler.address.iter()) {
writeln!(
@@ -5001,17 +5002,26 @@ template <typename A>
sampler.border_color.as_str(),
)?;
}
//TODO: I'm not able to feed this in a way that MSL likes:
//>error: use of undeclared identifier 'lod_clamp'
//>error: no member named 'max_anisotropy' in namespace 'metal'
if false {
if options.lang_version >= (1, 2) {
if let Some(ref lod) = sampler.lod_clamp {
writeln!(self.out, "{}lod_clamp({},{}),", level, lod.start, lod.end,)?;
writeln!(
self.out,
"{}{}::lod_clamp({},{}),",
level, NAMESPACE, lod.start, lod.end,
)?;
}
if let Some(aniso) = sampler.max_anisotropy {
writeln!(self.out, "{}max_anisotropy({}),", level, aniso.get(),)?;
writeln!(
self.out,
"{}{}::max_anisotropy({}),",
level,
NAMESPACE,
aniso.get(),
)?;
}
}
if sampler.compare_func != sm::CompareFunc::Never {
writeln!(
self.out,
@@ -8119,7 +8129,7 @@ template <typename A>
NAMESPACE,
name
)?;
self.put_inline_sampler_properties(back::Level(2), sampler)?;
self.put_inline_sampler_properties(back::Level(2), sampler, options)?;
writeln!(self.out, "{});", back::INDENT)?;
} else if let crate::TypeInner::Image {
class: crate::ImageClass::External,
+2
View File
@@ -62,6 +62,8 @@ fragment fs_mainOutput fs_main(
metal::r_address::clamp_to_edge,
metal::mag_filter::linear,
metal::min_filter::linear,
metal::lod_clamp(0.5,10),
metal::max_anisotropy(8),
metal::coord::normalized
);
const VertexOutput in = { position, varyings_1.uv };