Remove the old allocator visualizer. Keep the setting but hide it. Other feedback

This commit is contained in:
Henrik Rydgård 2021-11-23 08:53:19 +01:00
parent 8f29d9542c
commit f991f6a789
5 changed files with 7 additions and 82 deletions

View file

@ -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;
}

View file

@ -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");

View file

@ -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_Vulkan *>(gpu);
VulkanDeviceAllocator *alloc = gpuVulkan->GetTextureCache()->GetAllocator();
std::vector<Draw::Texture *> texturesToDelete;
for (int i = 0; i < alloc->GetSlabCount(); i++) {
std::vector<uint8_t> 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<uint8_t> 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) {

View file

@ -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();

View file

@ -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);