Skip to content

Commit f2fd20d

Browse files
committed
Added MipLODBias clamping, thanks to @ShmidtS
1 parent 284841f commit f2fd20d

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

OptiScaler/hooks/D3D11_Hooks.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,8 @@ static HRESULT hkCreateSamplerState(ID3D11Device* This, const D3D11_SAMPLER_DESC
462462
State::Instance().lastMipBias = newDesc.MipLODBias;
463463
}
464464

465+
newDesc.MipLODBias = std::clamp(newDesc.MipLODBias, -16.0f, 15.99f);
466+
465467
return o_CreateSamplerState(This, &newDesc, ppSamplerState);
466468
}
467469

OptiScaler/hooks/D3D12_Hooks.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ static void ApplySamplerOverrides(D3D12_STATIC_SAMPLER_DESC& samplerDesc)
181181
}
182182
}
183183

184+
samplerDesc.MipLODBias = std::clamp(samplerDesc.MipLODBias, -16.0f, 15.99f);
185+
184186
if (Config::Instance()->AnisotropyOverride.has_value())
185187
{
186188
LOG_DEBUG("Overriding {2:X} to anisotropic filtering {0} -> {1}", samplerDesc.MaxAnisotropy,

0 commit comments

Comments
 (0)