In the example below, does it mean that all filtering options (mag_filter, min_filter, ...) are set to linear? I can't find anything in documentation for just "filter".
constexpr sampler textureSampler (filter::linear, address::clamp_to_edge, coord::pixel);
Almost. It fills min_filter
and mag_filter
, but not mip_filter
. It's very unfortunate that it's not documented. However, you can go into metal_texture
header from Xcode, and you will see
constexpr METAL_FUNC _sampler_state _build_sampler_state(_sampler_state s, filter flt)
{
return
{
s.s_address_v, s.t_address_v, s.r_address_v,
static_cast<uchar>(flt), static_cast<uchar>(flt), s.mip_filter_v,
s.coord_v, s.compare_func_v,
s.max_anisotropy_v, s.lod_clamp_min_v, s.lod_clamp_max_v,
s.border_color_v, s.reduction_v,
};
}
and if you check out _sampler_state
struct _sampler_state
{
uchar s_address_v;
uchar t_address_v;
uchar r_address_v;
uchar mag_filter_v;
uchar min_filter_v;
uchar mip_filter_v;
uchar coord_v;
uchar compare_func_v;
uchar max_anisotropy_v;
float lod_clamp_min_v;
float lod_clamp_max_v;
uchar border_color_v;
uchar reduction_v;
};
so you can see that it will set static_cast<uchar>(flt)
in the mag_filter_v
, and min_filter_v
.
I think the mip_filter
is conceptually different enough that it can't be set with those.