metal: fix texture memory tracking

This commit is contained in:
Sasha Szpakowski
2024-07-16 17:44:58 -03:00
parent 679f3bdaa9
commit 304bf8bb83
5 changed files with 35 additions and 45 deletions
+3 -18
View File
@@ -237,23 +237,6 @@ bool Texture::loadVolatile()
}
}
int64 memsize = 0;
if (root)
{
for (int mip = 0; mip < getMipmapCount(); mip++)
{
int w = getPixelWidth(mip);
int h = getPixelHeight(mip);
int slices = getDepth(mip) * layerCount;
memsize += getPixelFormatSliceSize(format, w, h) * slices;
}
memsize *= static_cast<int>(msaaSamples);
}
setGraphicsMemorySize(memsize);
if (!debugName.empty())
{
if (vgfx->getEnabledOptionalInstanceExtensions().debugInfo)
@@ -275,6 +258,8 @@ bool Texture::loadVolatile()
}
}
updateGraphicsMemorySize(true);
return true;
}
@@ -301,7 +286,7 @@ void Texture::unloadVolatile()
textureImage = VK_NULL_HANDLE;
textureImageAllocation = VK_NULL_HANDLE;
setGraphicsMemorySize(0);
updateGraphicsMemorySize(false);
}
Texture::~Texture()