mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
vulkan: report approximate used texture memory
This commit is contained in:
@@ -187,6 +187,20 @@ bool Texture::loadVolatile()
|
||||
}
|
||||
}
|
||||
|
||||
int64 memsize = 0;
|
||||
|
||||
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);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -210,6 +224,8 @@ void Texture::unloadVolatile()
|
||||
});
|
||||
|
||||
textureImage = VK_NULL_HANDLE;
|
||||
|
||||
setGraphicsMemorySize(0);
|
||||
}
|
||||
|
||||
Texture::~Texture()
|
||||
|
||||
Reference in New Issue
Block a user