Browse Source

Fix an infinite loop in plDxPipeline.

H'Uru PR #719 commit log:

commit 5f53b86494605c484c0b304e0a5ab15a07929106
Author: Adam Johnson <AdamJohnso@gmail.com>
Date:   Fri Sep 4 07:38:15 2020 -0400

    Fix an infinite loop in plDXPipeline.

    This was observed in a 2x2 DXT1 mipmap produced by Korman. While Korman
    should probably force such a thing to be uncompressed, the pipeline
    should also not be able to enter such an obviously invalid state.

M       Sources/Plasma/PubUtilLib/plPipeline/DX/plDXPipeline.cpp
tickets/18/18/1
Adam Johnson 3 years ago committed by rarified
parent
commit
e2aec8d52c
  1. 3
      Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp

3
Sources/Plasma/PubUtilLib/plPipeline/plDXPipeline.cpp

@ -8663,10 +8663,9 @@ hsBool plDXPipeline::IProcessMipmapLevels( plMipmap *mipmap, UInt32 &numLevels,
if( mipmap->IsCompressed() || !( fSettings.fD3DCaps & kCapsDoesSmallTextures ) ) if( mipmap->IsCompressed() || !( fSettings.fD3DCaps & kCapsDoesSmallTextures ) )
{ {
mipmap->SetCurrLevel( maxLevel ); mipmap->SetCurrLevel( maxLevel );
while( ( mipmap->GetCurrWidth() | mipmap->GetCurrHeight() ) & sizeMask ) while( maxLevel > 0 && (( mipmap->GetCurrWidth() | mipmap->GetCurrHeight() ) & sizeMask) )
{ {
maxLevel--; maxLevel--;
hsAssert( maxLevel >= 0, "How was this ever compressed?" );
mipmap->SetCurrLevel( maxLevel ); mipmap->SetCurrLevel( maxLevel );
} }
} }

Loading…
Cancel
Save