diff --git a/GPU/Common/FramebufferManagerCommon.cpp b/GPU/Common/FramebufferManagerCommon.cpp index 350f6d9fd6..95d62a6b8e 100644 --- a/GPU/Common/FramebufferManagerCommon.cpp +++ b/GPU/Common/FramebufferManagerCommon.cpp @@ -19,9 +19,6 @@ #include #include -#include "ext/imgui/imgui.h" -#include "ext/imgui/imgui_impl_thin3d.h" - #include "Common/GPU/thin3d.h" #include "Common/Data/Collections/TinySet.h" #include "Common/Data/Convert/ColorConv.h" @@ -3649,55 +3646,3 @@ static void ApplyKillzoneFramebufferSplit(FramebufferHeuristicParams *params, in *drawing_width = 480; } } - -void FramebufferManagerCommon::DrawImGuiDebug(int &selected) const { - ImGui::BeginTable("framebuffers", 4); - ImGui::TableSetupColumn("Tag", ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("Color Addr", ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("Depth Addr", ImGuiTableColumnFlags_WidthFixed); - ImGui::TableSetupColumn("Size", ImGuiTableColumnFlags_WidthFixed); - - ImGui::TableHeadersRow(); - - for (int i = 0; i < (int)vfbs_.size(); i++) { - ImGui::TableNextRow(); - ImGui::TableNextColumn(); - - auto &vfb = vfbs_[i]; - - const char *tag = vfb->fbo ? vfb->fbo->Tag() : "(no tag)"; - - ImGui::PushID(i); - if (ImGui::Selectable(tag, selected == i, ImGuiSelectableFlags_AllowDoubleClick | ImGuiSelectableFlags_SpanAllColumns)) { - selected = i; - } - if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { - selected = i; - ImGui::OpenPopup("framebufferPopup"); - } - ImGui::TableNextColumn(); - ImGui::Text("%08x", vfb->fb_address); - ImGui::TableNextColumn(); - ImGui::Text("%08x", vfb->z_address); - ImGui::TableNextColumn(); - ImGui::Text("%dx%d", vfb->width, vfb->height); - if (ImGui::BeginPopup("framebufferPopup")) { - ImGui::Text("Framebuffer: %s", tag); - ImGui::EndPopup(); - } - ImGui::PopID(); - } - ImGui::EndTable(); - - // Fix out-of-bounds issues when framebuffers are removed. - if (selected >= vfbs_.size()) { - selected = -1; - } - - if (selected != -1) { - // Now, draw the image of the selected framebuffer. - Draw::Framebuffer *fb = vfbs_[selected]->fbo; - ImTextureID texId = ImGui_ImplThin3d_AddFBAsTextureTemp(fb, Draw::Aspect::COLOR_BIT, ImGuiPipeline::TexturedOpaque); - ImGui::Image(texId, ImVec2(fb->Width(), fb->Height())); - } -} diff --git a/GPU/Common/FramebufferManagerCommon.h b/GPU/Common/FramebufferManagerCommon.h index ee9cd6481c..63a3bf011f 100644 --- a/GPU/Common/FramebufferManagerCommon.h +++ b/GPU/Common/FramebufferManagerCommon.h @@ -490,7 +490,9 @@ public: bool PresentedThisFrame() const; - void DrawImGuiDebug(int &selected) const; + const std::vector &GetVFBs() const { + return vfbs_; + } protected: virtual void ReadbackFramebuffer(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel, Draw::ReadbackMode mode); diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 4230c3529d..6c5af27345 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -42,6 +42,8 @@ GPU_Vulkan::GPU_Vulkan(GraphicsContext *gfxCtx, Draw::DrawContext *draw) : GPUCommonHW(gfxCtx, draw), drawEngine_(draw) { + _assert_(draw); + gstate_c.SetUseFlags(CheckGPUFeatures()); VulkanContext *vulkan = (VulkanContext *)gfxCtx->GetAPIContext(); diff --git a/UI/ImDebugger/ImGe.cpp b/UI/ImDebugger/ImGe.cpp index a6c999ec82..c2b8327a2d 100644 --- a/UI/ImDebugger/ImGe.cpp +++ b/UI/ImDebugger/ImGe.cpp @@ -33,7 +33,58 @@ void DrawFramebuffersWindow(ImConfig &cfg, FramebufferManagerCommon *framebuffer return; } - framebufferManager->DrawImGuiDebug(cfg.selectedFramebuffer); + ImGui::BeginTable("framebuffers", 4); + ImGui::TableSetupColumn("Tag", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Color Addr", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Depth Addr", ImGuiTableColumnFlags_WidthFixed); + ImGui::TableSetupColumn("Size", ImGuiTableColumnFlags_WidthFixed); + + ImGui::TableHeadersRow(); + + const std::vector &vfbs = framebufferManager->GetVFBs(); + + for (int i = 0; i < (int)vfbs.size(); i++) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + + auto &vfb = vfbs[i]; + + const char *tag = vfb->fbo ? vfb->fbo->Tag() : "(no tag)"; + + ImGui::PushID(i); + if (ImGui::Selectable(tag, cfg.selectedFramebuffer == i, ImGuiSelectableFlags_AllowDoubleClick | ImGuiSelectableFlags_SpanAllColumns)) { + cfg.selectedFramebuffer = i; + } + if (ImGui::IsItemClicked(ImGuiMouseButton_Right)) { + cfg.selectedFramebuffer = i; + ImGui::OpenPopup("framebufferPopup"); + } + ImGui::TableNextColumn(); + ImGui::Text("%08x", vfb->fb_address); + ImGui::TableNextColumn(); + ImGui::Text("%08x", vfb->z_address); + ImGui::TableNextColumn(); + ImGui::Text("%dx%d", vfb->width, vfb->height); + if (ImGui::BeginPopup("framebufferPopup")) { + ImGui::Text("Framebuffer: %s", tag); + ImGui::EndPopup(); + } + ImGui::PopID(); + } + ImGui::EndTable(); + + // Fix out-of-bounds issues when framebuffers are removed. + if (cfg.selectedFramebuffer >= vfbs.size()) { + cfg.selectedFramebuffer = -1; + } + + if (cfg.selectedFramebuffer != -1) { + // Now, draw the image of the selected framebuffer. + Draw::Framebuffer *fb = vfbs[cfg.selectedFramebuffer]->fbo; + ImTextureID texId = ImGui_ImplThin3d_AddFBAsTextureTemp(fb, Draw::Aspect::COLOR_BIT, ImGuiPipeline::TexturedOpaque); + ImGui::Image(texId, ImVec2(fb->Width(), fb->Height())); + } + ImGui::End(); }