Skip to content

Commit

Permalink
viewer#2653 fix texture readback not being called and not setting val…
Browse files Browse the repository at this point in the history
…ues properly

Ex: Saving textures to hard drive sometimes fails
  • Loading branch information
akleshchev committed Sep 27, 2024
1 parent e74b48e commit 64c055f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions indra/newview/llviewertexture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2495,6 +2495,11 @@ bool LLViewerFetchedTexture::doLoadedCallbacks()
}
}

if (need_readback)
{
readbackRawImage();
}

//
// Run raw/auxiliary data callbacks
//
Expand Down Expand Up @@ -2744,10 +2749,22 @@ void LLViewerFetchedTexture::readbackRawImage()
if (mGLTexturep.notNull() && mGLTexturep->getTexName() != 0 &&
(mRawImage.isNull() || mRawImage->getWidth() < mGLTexturep->getWidth() || mRawImage->getHeight() < mGLTexturep->getHeight() ))
{
if (mRawImage.isNull())
{
sRawCount++;
}
mRawImage = new LLImageRaw();
if (!mGLTexturep->readBackRaw(-1, mRawImage, false))
{
mRawImage = nullptr;
mIsRawImageValid = false;
mRawDiscardLevel = INVALID_DISCARD_LEVEL;
sRawCount--;
}
else
{
mIsRawImageValid = true;
mRawDiscardLevel = mGLTexturep->getDiscardLevel();
}
}
}
Expand Down

0 comments on commit 64c055f

Please sign in to comment.