Mipmapping is now taken into consideration when calculating the VRAM usage.

This commit is contained in:
Leon Styhre 2022-09-07 21:17:01 +02:00
parent 11f2d2dfa1
commit b9303e5494
2 changed files with 11 additions and 5 deletions

View file

@ -38,8 +38,8 @@ TextureData::TextureData(bool tile)
, mScalableNonAspect {false}
, mHasRGBAData {false}
, mPendingRasterization {false}
, mLinearMagnify {false}
, mMipmapping {false}
, mLinearMagnify {false}
{
}
@ -314,8 +314,14 @@ void TextureData::setSourceSize(float width, float height)
size_t TextureData::getVRAMUsage()
{
if (mHasRGBAData || mTextureID != 0)
return mWidth * mHeight * 4;
else
if (mHasRGBAData || mTextureID != 0) {
// The estimated increase in VRAM usage with mipmapping enabled is 33%
if (mMipmapping)
return {static_cast<size_t>(static_cast<float>(mWidth * mHeight * 4) * 1.33f)};
else
return mWidth * mHeight * 4;
}
else {
return 0;
}
}

View file

@ -99,8 +99,8 @@ private:
std::atomic<bool> mScalableNonAspect;
std::atomic<bool> mHasRGBAData;
std::atomic<bool> mPendingRasterization;
std::atomic<bool> mMipmapping;
bool mLinearMagnify;
bool mMipmapping;
bool mReloadable;
};