Skip to content

Commit

Permalink
[d3d9] Clamp LOD in calls to SetLOD
Browse files Browse the repository at this point in the history
MSDN says this is clamped and returns the clamped value.

Closes: doitsujin#1869
  • Loading branch information
misyltoad committed Nov 11, 2021
1 parent 5d4b7db commit c22dcdb
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/d3d9/d3d9_texture.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c22dcdb

Please sign in to comment.