VideoBackends:Metal: Create samplers on demand

This commit is contained in:
TellowKrinkle
2022-06-13 00:56:25 -05:00
parent 61705b05da
commit e32213d031
2 changed files with 13 additions and 10 deletions

View File

@ -76,13 +76,19 @@ public:
id<MTLDepthStencilState> GetDepthStencil(DepthStencilSelector sel) { return m_dss[sel.value]; }
id<MTLSamplerState> GetSampler(SamplerSelector sel) { return m_samplers[sel.value]; }
id<MTLSamplerState> GetSampler(SamplerSelector sel)
{
if (__builtin_expect(!m_samplers[sel.value], false))
m_samplers[sel.value] = CreateSampler(sel);
return m_samplers[sel.value];
}
id<MTLSamplerState> GetSampler(SamplerState state) { return GetSampler(SamplerSelector(state)); }
void ReloadSamplers();
private:
MRCOwned<id<MTLSamplerState>> CreateSampler(SamplerSelector sel);
MRCOwned<id<MTLDepthStencilState>> m_dss[DepthStencilSelector::N_VALUES];
MRCOwned<id<MTLSamplerState>> m_samplers[SamplerSelector::N_VALUES];
};