mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-04-13 09:51:31 +02:00
VideoBackends/Metal: Fix anisotropic filtering handling.
This commit is contained in:
parent
1b85da9b85
commit
33a7283d3b
@ -44,7 +44,7 @@ struct DepthStencilSelector
|
||||
|
||||
struct SamplerSelector
|
||||
{
|
||||
u8 value;
|
||||
u16 value;
|
||||
SamplerSelector() : value(0) {}
|
||||
SamplerSelector(SamplerState state)
|
||||
{
|
||||
@ -54,17 +54,17 @@ struct SamplerSelector
|
||||
(static_cast<u32>(state.tm0.anisotropic_filtering) << 3);
|
||||
value |= (static_cast<u32>(state.tm0.wrap_u.Value()) +
|
||||
3 * static_cast<u32>(state.tm0.wrap_v.Value()))
|
||||
<< 4;
|
||||
<< 7;
|
||||
}
|
||||
FilterMode MinFilter() const { return static_cast<FilterMode>(value & 1); }
|
||||
FilterMode MagFilter() const { return static_cast<FilterMode>((value >> 1) & 1); }
|
||||
FilterMode MipFilter() const { return static_cast<FilterMode>((value >> 2) & 1); }
|
||||
WrapMode WrapU() const { return static_cast<WrapMode>((value >> 4) % 3); }
|
||||
WrapMode WrapV() const { return static_cast<WrapMode>((value >> 4) / 3); }
|
||||
bool AnisotropicFiltering() const { return ((value >> 3) & 1); }
|
||||
WrapMode WrapU() const { return static_cast<WrapMode>((value >> 7) % 3); }
|
||||
WrapMode WrapV() const { return static_cast<WrapMode>((value >> 7) / 3); }
|
||||
u32 AnisotropicFiltering() const { return ((value >> 3) & 0xf); }
|
||||
|
||||
bool operator==(const SamplerSelector& other) const { return value == other.value; }
|
||||
static constexpr size_t N_VALUES = (1 << 4) * 9;
|
||||
static constexpr size_t N_VALUES = (1 << 7) * 9;
|
||||
};
|
||||
|
||||
class ObjectCache
|
||||
|
@ -173,10 +173,10 @@ MRCOwned<id<MTLSamplerState>> Metal::ObjectCache::CreateSampler(SamplerSelector
|
||||
[desc setTAddressMode:Convert(sel.WrapV())];
|
||||
[desc setMaxAnisotropy:1 << sel.AnisotropicFiltering()];
|
||||
[desc setLabel:MRCTransfer([[NSString alloc]
|
||||
initWithFormat:@"%s%s%s %s%s%s", to_string(sel.MinFilter()),
|
||||
initWithFormat:@"%s%s%s %s%s%d", to_string(sel.MinFilter()),
|
||||
to_string(sel.MagFilter()), to_string(sel.MipFilter()),
|
||||
to_string(sel.WrapU()), to_string(sel.WrapV()),
|
||||
sel.AnisotropicFiltering() ? "(AF)" : ""])];
|
||||
1 << sel.AnisotropicFiltering()])];
|
||||
return MRCTransfer([Metal::g_device newSamplerStateWithDescriptor:desc]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user