Add more memory profiler categories

This commit is contained in:
Wojtek Figat
2025-05-25 18:38:07 +02:00
parent a74c5e7943
commit 9dc4dbc6d7
6 changed files with 112 additions and 38 deletions

View File

@@ -503,7 +503,17 @@ bool GPUTexture::Init(const GPUTextureDescription& desc)
LOG(Warning, "Cannot initialize texture. Description: {0}", desc.ToString());
return true;
}
PROFILE_MEM_INC(GraphicsTextures, GetMemoryUsage());
#if COMPILE_WITH_PROFILER
auto group = ProfilerMemory::Groups::GraphicsTextures;
if (_desc.IsRenderTarget())
group = ProfilerMemory::Groups::GraphicsRenderTargets;
else if (_desc.IsCubeMap())
group = ProfilerMemory::Groups::GraphicsCubeMaps;
else if (_desc.IsVolume())
group = ProfilerMemory::Groups::GraphicsVolumeTextures;
ProfilerMemory::IncrementGroup(group, _memoryUsage);
#endif
// Render targets and depth buffers doesn't support normal textures streaming and are considered to be always resident
if (IsRegularTexture() == false)
@@ -593,7 +603,17 @@ GPUResourceType GPUTexture::GetResourceType() const
void GPUTexture::OnReleaseGPU()
{
PROFILE_MEM_DEC(GraphicsTextures, GetMemoryUsage());
#if COMPILE_WITH_PROFILER
auto group = ProfilerMemory::Groups::GraphicsTextures;
if (_desc.IsRenderTarget())
group = ProfilerMemory::Groups::GraphicsRenderTargets;
else if (_desc.IsCubeMap())
group = ProfilerMemory::Groups::GraphicsCubeMaps;
else if (_desc.IsVolume())
group = ProfilerMemory::Groups::GraphicsVolumeTextures;
ProfilerMemory::DecrementGroup(group, _memoryUsage);
#endif
_desc.Clear();
_residentMipLevels = 0;
}