From 325e4d34a0adaa34808b7212594c0f25b88bfb96 Mon Sep 17 00:00:00 2001 From: "Skyth (Asilkan)" <19259897+blueskythlikesclouds@users.noreply.github.com> Date: Fri, 4 Apr 2025 00:17:00 +0300 Subject: [PATCH] Fix profiler crashing in the installer. (#1507) --- UnleashedRecomp/gpu/video.cpp | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/UnleashedRecomp/gpu/video.cpp b/UnleashedRecomp/gpu/video.cpp index 8815bb87..2333dfb7 100644 --- a/UnleashedRecomp/gpu/video.cpp +++ b/UnleashedRecomp/gpu/video.cpp @@ -2437,18 +2437,22 @@ static void DrawProfiler() ImGui::NewLine(); - O1HeapDiagnostics diagnostics, physicalDiagnostics; + if (g_userHeap.heap != nullptr && g_userHeap.physicalHeap != nullptr) { - std::lock_guard lock(g_userHeap.mutex); - diagnostics = o1heapGetDiagnostics(g_userHeap.heap); + O1HeapDiagnostics diagnostics, physicalDiagnostics; + { + std::lock_guard lock(g_userHeap.mutex); + diagnostics = o1heapGetDiagnostics(g_userHeap.heap); + } + { + std::lock_guard lock(g_userHeap.physicalMutex); + physicalDiagnostics = o1heapGetDiagnostics(g_userHeap.physicalHeap); + } + + ImGui::Text("Heap Allocated: %d MB", int32_t(diagnostics.allocated / (1024 * 1024))); + ImGui::Text("Physical Heap Allocated: %d MB", int32_t(physicalDiagnostics.allocated / (1024 * 1024))); } - { - std::lock_guard lock(g_userHeap.physicalMutex); - physicalDiagnostics = o1heapGetDiagnostics(g_userHeap.physicalHeap); - } - - ImGui::Text("Heap Allocated: %d MB", int32_t(diagnostics.allocated / (1024 * 1024))); - ImGui::Text("Physical Heap Allocated: %d MB", int32_t(physicalDiagnostics.allocated / (1024 * 1024))); + ImGui::Text("GPU Waits: %d", int32_t(g_waitForGPUCount)); ImGui::Text("Buffer Uploads: %d", int32_t(g_bufferUploadCount)); ImGui::NewLine();