Same as previous commit for the framebuffermanager debug UI

This commit is contained in:
Henrik Rydgård
2025-05-26 19:39:33 +02:00
parent bdf08c84fd
commit 2e7f2ffcd4
4 changed files with 57 additions and 57 deletions
-55
View File
@@ -19,9 +19,6 @@
#include <sstream>
#include <cmath>
#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()));
}
}
+3 -1
View File
@@ -490,7 +490,9 @@ public:
bool PresentedThisFrame() const;
void DrawImGuiDebug(int &selected) const;
const std::vector<VirtualFramebuffer *> &GetVFBs() const {
return vfbs_;
}
protected:
virtual void ReadbackFramebuffer(VirtualFramebuffer *vfb, int x, int y, int w, int h, RasterChannel channel, Draw::ReadbackMode mode);
+2
View File
@@ -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();
+52 -1
View File
@@ -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<VirtualFramebuffer *> &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();
}