Ansariel 2024-09-09 19:51:36 +02:00
commit 43ad85f315
4 changed files with 27 additions and 16 deletions

View File

@ -4750,6 +4750,12 @@ void LLWindowWin32::LLWindowWin32Thread::checkDXMem()
{
if (!mGLReady || mGotGLBuffer) { return; }
if ((gGLManager.mHasAMDAssociations || gGLManager.mHasNVXGpuMemoryInfo) && gGLManager.mVRAM != 0)
{ // OpenGL already told us the memory budget, don't ask DX
mGotGLBuffer = true;
return;
}
IDXGIFactory4* p_factory = nullptr;
HRESULT res = CreateDXGIFactory1(__uuidof(IDXGIFactory4), (void**)&p_factory);
@ -4845,7 +4851,7 @@ void LLWindowWin32::LLWindowWin32Thread::run()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_WIN32;
// Check memory budget using DirectX
// Check memory budget using DirectX if OpenGL doesn't have the means to tell us
checkDXMem();
if (mWindowHandleThrd != 0)

View File

@ -1617,6 +1617,17 @@ void LLViewerFetchedTexture::postCreateTexture()
setActive();
// rebuild any volumes that are using this texture for sculpts in case their LoD has changed
for (U32 i = 0; i < mNumVolumes[LLRender::SCULPT_TEX]; ++i)
{
LLVOVolume* volume = mVolumeList[LLRender::SCULPT_TEX][i];
if (volume)
{
volume->mSculptChanged = true;
gPipeline.markRebuild(volume->mDrawable);
}
}
if (!needsToSaveRawImage())
{
mNeedsAux = false;
@ -2727,7 +2738,7 @@ void LLViewerFetchedTexture::destroyRawImage()
if (mAuxRawImage.notNull() && !needsToSaveRawImage())
{
sAuxCount--;
mAuxRawImage = NULL;
mAuxRawImage = nullptr;
}
if (mRawImage.notNull())
@ -2742,7 +2753,7 @@ void LLViewerFetchedTexture::destroyRawImage()
}
}
mRawImage = NULL;
mRawImage = nullptr;
mIsRawImageValid = false;
mRawDiscardLevel = INVALID_DISCARD_LEVEL;
@ -2854,7 +2865,9 @@ void LLViewerFetchedTexture::readbackRawImage()
{
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
if (mGLTexturep.notNull() && mGLTexturep->getTexName() != 0 && mRawImage.isNull())
// readback the raw image from vram if the current raw image is null or smaller than the texture
if (mGLTexturep.notNull() && mGLTexturep->getTexName() != 0 &&
(mRawImage.isNull() || mRawImage->getWidth() < mGLTexturep->getWidth() || mRawImage->getHeight() < mGLTexturep->getHeight() ))
{
mRawImage = new LLImageRaw();
if (!mGLTexturep->readBackRaw(-1, mRawImage, false))

View File

@ -1306,7 +1306,7 @@ void LLVOVolume::updateSculptTexture()
{
mSculptTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, true, LLGLTexture::BOOST_SCULPTED, LLViewerTexture::LOD_TEXTURE);
mSculptTexture->forceToSaveRawImage(0, F32_MAX);
mSculptTexture->addTextureStats(256.f*256.f);
mSculptTexture->setKnownDrawSize(256, 256);
}
mSkinInfoUnavaliable = false;
@ -1408,7 +1408,7 @@ void LLVOVolume::sculpt()
discard_level = mSculptTexture->getSavedRawImageLevel();
}
if (!raw_image)
if (!raw_image || raw_image->getWidth() < mSculptTexture->getWidth() || raw_image->getHeight() < mSculptTexture->getHeight())
{
// last resort, read back from GL
mSculptTexture->readbackRawImage();
@ -1495,17 +1495,8 @@ void LLVOVolume::sculpt()
mSculptTexture->updateBindStatsForTester() ;
}
}
getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset());
//notify rebuild any other VOVolumes that reference this sculpty volume
for (S32 i = 0; i < mSculptTexture->getNumVolumes(LLRender::SCULPT_TEX); ++i)
{
LLVOVolume* volume = (*(mSculptTexture->getVolumeList(LLRender::SCULPT_TEX)))[i];
if (volume != this && volume->getVolume() == getVolume())
{
gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY);
}
}
getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset());
}
}

View File

@ -463,6 +463,7 @@ public:
private:
friend class LLDrawable;
friend class LLFace;
friend class LLViewerFetchedTexture;
bool mFaceMappingChanged;
LLFrameTimer mTextureUpdateTimer;