diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index 39c13a0b7..da74874c7 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -165,6 +165,7 @@ void SoftGPU::CopyToCurrentFboFromDisplayRam(int srcwidth, int srcheight) { desc.format = Draw::DataFormat::R8G8B8A8_UNORM; desc.depth = 1; desc.mipLevels = 1; + desc.tag = "SoftGPU"; bool hasImage = true; if (!Memory::IsValidAddress(displayFramebuf_) || srcwidth == 0 || srcheight == 0) { hasImage = false; diff --git a/GPU/Vulkan/DebugVisVulkan.cpp b/GPU/Vulkan/DebugVisVulkan.cpp index 9002f82a7..bc0e17ad6 100644 --- a/GPU/Vulkan/DebugVisVulkan.cpp +++ b/GPU/Vulkan/DebugVisVulkan.cpp @@ -74,6 +74,7 @@ void DrawAllocatorVis(UIContext *ui, GPUInterface *gpu) { desc.format = Draw::DataFormat::R8G8B8A8_UNORM; desc.mipLevels = 1; desc.type = Draw::TextureType::LINEAR2D; + desc.tag = "DebugVis"; desc.initData.push_back(initData.data()); Draw::DrawContext *draw = ui->GetDrawContext(); diff --git a/UI/TextureUtil.cpp b/UI/TextureUtil.cpp index b86693e2b..3fdd3d82a 100644 --- a/UI/TextureUtil.cpp +++ b/UI/TextureUtil.cpp @@ -125,6 +125,7 @@ bool ManagedTexture::LoadFromFileData(const uint8_t *data, size_t dataSize, Imag desc.depth = 1; desc.mipLevels = generateMips ? potentialLevels : num_levels; desc.generateMips = generateMips && potentialLevels > num_levels; + desc.tag = "LoadedFileData"; for (int i = 0; i < num_levels; i++) { desc.initData.push_back(image[i]); } diff --git a/ext/native/gfx_es2/draw_text_android.cpp b/ext/native/gfx_es2/draw_text_android.cpp index f80994edd..7059fab39 100644 --- a/ext/native/gfx_es2/draw_text_android.cpp +++ b/ext/native/gfx_es2/draw_text_android.cpp @@ -206,6 +206,7 @@ void TextDrawerAndroid::DrawString(DrawBuffer &target, const char *str, float x, desc.height = entry->bmHeight; desc.depth = 1; desc.mipLevels = 1; + desc.tag = "TextDrawer"; uint16_t *bitmapData = new uint16_t[entry->bmWidth * entry->bmHeight]; jint* jimage = env_->GetIntArrayElements(imageData, nullptr); diff --git a/ext/native/gfx_es2/draw_text_qt.cpp b/ext/native/gfx_es2/draw_text_qt.cpp index 7b6ca8256..973e8d27a 100644 --- a/ext/native/gfx_es2/draw_text_qt.cpp +++ b/ext/native/gfx_es2/draw_text_qt.cpp @@ -114,6 +114,7 @@ void TextDrawerQt::DrawString(DrawBuffer &target, const char *str, float x, floa desc.height = entry->bmHeight; desc.depth = 1; desc.mipLevels = 1; + desc.tag = "TextDrawer"; uint16_t *bitmapData = new uint16_t[entry->bmWidth * entry->bmHeight]; for (int x = 0; x < entry->bmWidth; x++) { diff --git a/ext/native/gfx_es2/draw_text_win.cpp b/ext/native/gfx_es2/draw_text_win.cpp index 5bc066f29..aaa3b1d85 100644 --- a/ext/native/gfx_es2/draw_text_win.cpp +++ b/ext/native/gfx_es2/draw_text_win.cpp @@ -301,6 +301,7 @@ void TextDrawerWin32::DrawString(DrawBuffer &target, const char *str, float x, f desc.height = entry->bmHeight; desc.depth = 1; desc.mipLevels = 1; + desc.tag = "TextDrawer"; entry->texture = draw_->CreateTexture(desc); if (bitmapData16) delete[] bitmapData16; diff --git a/ext/native/thin3d/thin3d.h b/ext/native/thin3d/thin3d.h index d4f4134e6..2aa081c27 100644 --- a/ext/native/thin3d/thin3d.h +++ b/ext/native/thin3d/thin3d.h @@ -500,6 +500,8 @@ struct TextureDesc { int depth; int mipLevels; bool generateMips; + // Optional, for tracking memory usage. + std::string tag; // Does not take ownership over pointed-to data. std::vector initData; }; diff --git a/ext/native/thin3d/thin3d_vulkan.cpp b/ext/native/thin3d/thin3d_vulkan.cpp index 4fc6823ea..1344af164 100644 --- a/ext/native/thin3d/thin3d_vulkan.cpp +++ b/ext/native/thin3d/thin3d_vulkan.cpp @@ -311,7 +311,10 @@ public: Destroy(); } - VkImageView GetImageView() { return vkTex_->GetImageView(); } + VkImageView GetImageView() { + vkTex_->Touch(); + return vkTex_->GetImageView(); + } private: bool Create(VkCommandBuffer cmd, VulkanPushBuffer *pushBuffer, const TextureDesc &desc, VulkanDeviceAllocator *alloc); @@ -658,6 +661,7 @@ bool VKTexture::Create(VkCommandBuffer cmd, VulkanPushBuffer *push, const Textur height_ = desc.height; depth_ = desc.depth; vkTex_ = new VulkanTexture(vulkan_, alloc); + vkTex_->SetTag(desc.tag); VkFormat vulkanFormat = DataFormatToVulkan(format_); int stride = desc.width * (int)DataFormatSizeInBytes(format_); int bpp = GetBpp(vulkanFormat);