[d3d9] Clamp LOD in calls to SetLOD

MSDN says this is clamped and returns the clamped value.

Closes: #1869
This commit is contained in:
Joshua Ashton 2021-11-11 23:52:35 +00:00
parent 5d4b7db9e6
commit c22dcdbaa3
1 changed files with 6 additions and 4 deletions

View File

@ -56,11 +56,13 @@ namespace dxvk {
DWORD STDMETHODCALLTYPE SetLOD(DWORD LODNew) final {
DWORD oldLod = m_lod;
m_lod = LODNew;
m_lod = std::min<DWORD>(LODNew, m_texture.Desc()->MipLevels - 1);
m_texture.CreateSampleView(LODNew);
if (this->GetPrivateRefCount() > 0)
this->m_parent->MarkTextureBindingDirty(this);
if (m_lod != oldLod) {
m_texture.CreateSampleView(LODNew);
if (this->GetPrivateRefCount() > 0)
this->m_parent->MarkTextureBindingDirty(this);
}
return oldLod;
}