diff --git a/Common/GPU/Vulkan/VulkanMemory.cpp b/Common/GPU/Vulkan/VulkanMemory.cpp index d4f1c25a2b..c9cd7e455d 100644 --- a/Common/GPU/Vulkan/VulkanMemory.cpp +++ b/Common/GPU/Vulkan/VulkanMemory.cpp @@ -130,17 +130,6 @@ void VulkanPushBuffer::Unmap() { if (!writePtr_) return; - /* - // We could never hit this path before because we specified the mask explicitly. - if ((memoryPropertyMask_ & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT) == 0) { - VkMappedMemoryRange range{ VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE }; - range.offset = 0; - range.size = offset_; - range.memory = buffers_[buf_].deviceMemory; - vkFlushMappedMemoryRanges(vulkan_->GetDevice(), 1, &range); - } - */ - vmaUnmapMemory(vulkan_->Allocator(), buffers_[buf_].allocation); writePtr_ = nullptr; } diff --git a/GPU/Debugger/Record.cpp b/GPU/Debugger/Record.cpp index f26db44bb8..e6e91dc769 100644 --- a/GPU/Debugger/Record.cpp +++ b/GPU/Debugger/Record.cpp @@ -590,7 +590,7 @@ void NotifyDisplay(u32 framebuf, int stride, int fmt) { void NotifyFrame() { const bool noDisplayAction = flipLastAction + 4 < gpuStats.numFlips; - // We do this only to catch things that don't call NotifyDisplay. + // We do this only to catch things that don't call NotifyFrame. if (active && HasDrawCommands() && noDisplayAction) { NOTICE_LOG(SYSTEM, "Recording complete on frame"); diff --git a/GPU/Vulkan/DebugVisVulkan.cpp b/GPU/Vulkan/DebugVisVulkan.cpp index 25eeb44a1b..82acb8c0fd 100644 --- a/GPU/Vulkan/DebugVisVulkan.cpp +++ b/GPU/Vulkan/DebugVisVulkan.cpp @@ -32,74 +32,7 @@ #undef DrawText void DrawAllocatorVis(UIContext *ui, GPUInterface *gpu) { - /* - - if (!gpu) { - return; - } - using namespace Draw; - const int padding = 10; - const int columnWidth = 256; - const int starty = padding * 8; - int x = padding; - int y = starty; - int w = columnWidth; // We will double this when actually drawing to make the pixels visible. - - ui->Begin(); - - GPU_Vulkan *gpuVulkan = static_cast(gpu); - VulkanDeviceAllocator *alloc = gpuVulkan->GetTextureCache()->GetAllocator(); - std::vector texturesToDelete; - for (int i = 0; i < alloc->GetSlabCount(); i++) { - std::vector usage = alloc->GetSlabUsage(i); - int h = ((int)usage.size() + w - 1) / w; - - if (y + h + padding > ui->GetBounds().h) { - y = starty; - x += columnWidth + padding; - } - - std::vector initData(w * h * 4); - uint32_t *wideData = (uint32_t *)initData.data(); - - // Convert to nice colors. If we really wanted to save on memory, we could use a 16-bit texture... - for (size_t j = 0; j < usage.size(); j++) { - switch (usage[j]) { - case 0: wideData[j] = 0xFF333333; break; - case 1: wideData[j] = 0xFF33FF33; break; - case 2: wideData[j] = 0xFF3333FF; break; - default: wideData[j] = 0xFFFF00FF; break; // Magenta - if you see this, need to add more cases. - } - } - - Draw::TextureDesc desc{}; - desc.width = w; - desc.height = h; - desc.depth = 1; - 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(); - Draw::Texture *tex = draw->CreateTexture(desc); - - UI::Drawable white(0xFFFFFFFF); - draw->BindTexture(0, tex); - // Cheap black border. - ui->Draw()->Rect(x-2, y-2, w+4, h+4, 0xE0000000); - ui->Draw()->Rect(x, y, w, h, 0xFFFFFFFF); - ui->Flush(); - texturesToDelete.push_back(tex); - - y += h + padding; - } - ui->Flush(); - - for (auto iter : texturesToDelete) - iter->Release(); - */ + // TODO: Make a new allocator visualizer for VMA. } void DrawGPUProfilerVis(UIContext *ui, GPUInterface *gpu) { diff --git a/GPU/Vulkan/TextureCacheVulkan.cpp b/GPU/Vulkan/TextureCacheVulkan.cpp index ec524d7e2a..15cba3afd5 100644 --- a/GPU/Vulkan/TextureCacheVulkan.cpp +++ b/GPU/Vulkan/TextureCacheVulkan.cpp @@ -329,7 +329,9 @@ void TextureCacheVulkan::StartFrame() { // Since textures are 2D maybe we should square this, but might get too non-aggressive. slabPressureLimit *= g_Config.iTexScalingLevel; } - Decimate(false); // TODO: Use some indication from VMA. + // TODO: Use some indication from VMA. + // Maybe see https://gpuopen-librariesandsdks.github.io/VulkanMemoryAllocator/html/staying_within_budget.html#staying_within_budget_querying_for_budget . + Decimate(false); } computeShaderManager_.BeginFrame(); diff --git a/UI/DevScreens.cpp b/UI/DevScreens.cpp index 389fdf0967..0c66d1fe9b 100644 --- a/UI/DevScreens.cpp +++ b/UI/DevScreens.cpp @@ -88,7 +88,8 @@ void DevMenu::CreatePopupContents(UI::ViewGroup *parent) { items->Add(new Choice(dev->T("Jit Compare")))->OnClick.Handle(this, &DevMenu::OnJitCompare); items->Add(new Choice(dev->T("Shader Viewer")))->OnClick.Handle(this, &DevMenu::OnShaderView); if (g_Config.iGPUBackend == (int)GPUBackend::VULKAN) { - items->Add(new CheckBox(&g_Config.bShowAllocatorDebug, dev->T("Allocator Viewer"))); + // TODO: Make a new allocator visualizer for VMA. + // items->Add(new CheckBox(&g_Config.bShowAllocatorDebug, dev->T("Allocator Viewer"))); items->Add(new CheckBox(&g_Config.bShowGpuProfile, dev->T("GPU Profile"))); } items->Add(new Choice(dev->T("Toggle Freeze")))->OnClick.Handle(this, &DevMenu::OnFreezeFrame);