mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Merge pull request #18462 from hrydgard/framebuffer-listing-overlay
Framebuffer listing overlay
This commit is contained in:
commit
d584162e06
9 changed files with 38 additions and 27 deletions
|
@ -166,4 +166,5 @@ enum class DebugOverlay : int {
|
||||||
AUDIO,
|
AUDIO,
|
||||||
GPU_PROFILE,
|
GPU_PROFILE,
|
||||||
GPU_ALLOCATOR,
|
GPU_ALLOCATOR,
|
||||||
|
FRAMEBUFFER_LIST,
|
||||||
};
|
};
|
||||||
|
|
|
@ -3195,20 +3195,11 @@ void FramebufferManagerCommon::RebindFramebuffer(const char *tag) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FramebufferInfo> FramebufferManagerCommon::GetFramebufferList() const {
|
std::vector<const VirtualFramebuffer *> FramebufferManagerCommon::GetFramebufferList() const {
|
||||||
std::vector<FramebufferInfo> list;
|
std::vector<const VirtualFramebuffer *> list;
|
||||||
|
|
||||||
for (auto vfb : vfbs_) {
|
for (auto vfb : vfbs_) {
|
||||||
FramebufferInfo info;
|
list.push_back(vfb);
|
||||||
info.fb_address = vfb->fb_address;
|
|
||||||
info.z_address = vfb->z_address;
|
|
||||||
info.format = vfb->fb_format;
|
|
||||||
info.width = vfb->width;
|
|
||||||
info.height = vfb->height;
|
|
||||||
info.fbo = vfb->fbo;
|
|
||||||
list.push_back(info);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -327,7 +327,7 @@ public:
|
||||||
void SetDepthFrameBuffer(bool isClearingDepth);
|
void SetDepthFrameBuffer(bool isClearingDepth);
|
||||||
|
|
||||||
void RebindFramebuffer(const char *tag);
|
void RebindFramebuffer(const char *tag);
|
||||||
std::vector<FramebufferInfo> GetFramebufferList() const;
|
std::vector<const VirtualFramebuffer *> GetFramebufferList() const;
|
||||||
|
|
||||||
void CopyDisplayToOutput(bool reallyDirty);
|
void CopyDisplayToOutput(bool reallyDirty);
|
||||||
|
|
||||||
|
|
|
@ -727,7 +727,7 @@ bool GPUCommonHW::GetOutputFramebuffer(GPUDebugBuffer &buffer) {
|
||||||
return framebufferManager_ ? framebufferManager_->GetOutputFramebuffer(buffer) : false;
|
return framebufferManager_ ? framebufferManager_->GetOutputFramebuffer(buffer) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<FramebufferInfo> GPUCommonHW::GetFramebufferList() const {
|
std::vector<const VirtualFramebuffer *> GPUCommonHW::GetFramebufferList() const {
|
||||||
return framebufferManager_->GetFramebufferList();
|
return framebufferManager_->GetFramebufferList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ public:
|
||||||
bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override;
|
bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) override;
|
||||||
bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override;
|
bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) override;
|
||||||
bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override;
|
bool GetOutputFramebuffer(GPUDebugBuffer &buffer) override;
|
||||||
std::vector<FramebufferInfo> GetFramebufferList() const override;
|
std::vector<const VirtualFramebuffer *> GetFramebufferList() const override;
|
||||||
bool GetCurrentTexture(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
|
bool GetCurrentTexture(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;
|
||||||
bool GetCurrentClut(GPUDebugBuffer &buffer) override;
|
bool GetCurrentClut(GPUDebugBuffer &buffer) override;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
struct PspGeListArgs;
|
struct PspGeListArgs;
|
||||||
struct GPUgstate;
|
struct GPUgstate;
|
||||||
class PointerWrap;
|
class PointerWrap;
|
||||||
|
struct VirtualFramebuffer;
|
||||||
|
|
||||||
enum DisplayListStatus {
|
enum DisplayListStatus {
|
||||||
// The list has been completed
|
// The list has been completed
|
||||||
|
@ -126,16 +127,6 @@ enum class GPUCopyFlag {
|
||||||
};
|
};
|
||||||
ENUM_CLASS_BITOPS(GPUCopyFlag);
|
ENUM_CLASS_BITOPS(GPUCopyFlag);
|
||||||
|
|
||||||
// Used for debug
|
|
||||||
struct FramebufferInfo {
|
|
||||||
u32 fb_address;
|
|
||||||
u32 z_address;
|
|
||||||
int format;
|
|
||||||
u32 width;
|
|
||||||
u32 height;
|
|
||||||
void* fbo;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct DisplayListStackEntry {
|
struct DisplayListStackEntry {
|
||||||
u32 pc;
|
u32 pc;
|
||||||
u32 offsetAddr;
|
u32 offsetAddr;
|
||||||
|
@ -271,7 +262,7 @@ public:
|
||||||
virtual void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) = 0;
|
virtual void GetReportingInfo(std::string &primaryInfo, std::string &fullInfo) = 0;
|
||||||
virtual const std::list<int>& GetDisplayLists() = 0;
|
virtual const std::list<int>& GetDisplayLists() = 0;
|
||||||
// TODO: Currently Qt only, needs to be cleaned up.
|
// TODO: Currently Qt only, needs to be cleaned up.
|
||||||
virtual std::vector<FramebufferInfo> GetFramebufferList() const = 0;
|
virtual std::vector<const VirtualFramebuffer *> GetFramebufferList() const = 0;
|
||||||
virtual s64 GetListTicks(int listid) const = 0;
|
virtual s64 GetListTicks(int listid) const = 0;
|
||||||
|
|
||||||
// For debugging. The IDs returned are opaque, do not poke in them or display them in any way.
|
// For debugging. The IDs returned are opaque, do not poke in them or display them in any way.
|
||||||
|
|
|
@ -138,7 +138,7 @@ public:
|
||||||
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
|
void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) override;
|
||||||
void CopyDisplayToOutput(bool reallyDirty) override;
|
void CopyDisplayToOutput(bool reallyDirty) override;
|
||||||
void GetStats(char *buffer, size_t bufsize) override;
|
void GetStats(char *buffer, size_t bufsize) override;
|
||||||
std::vector<FramebufferInfo> GetFramebufferList() const override { return std::vector<FramebufferInfo>(); }
|
std::vector<const VirtualFramebuffer *> GetFramebufferList() const override { return std::vector<const VirtualFramebuffer *>(); }
|
||||||
void InvalidateCache(u32 addr, int size, GPUInvalidationType type) override;
|
void InvalidateCache(u32 addr, int size, GPUInvalidationType type) override;
|
||||||
void PerformWriteFormattedFromMemory(u32 addr, int size, int width, GEBufferFormat format) override;
|
void PerformWriteFormattedFromMemory(u32 addr, int size, int width, GEBufferFormat format) override;
|
||||||
bool PerformMemoryCopy(u32 dest, u32 src, int size, GPUCopyFlag flags = GPUCopyFlag::NONE) override;
|
bool PerformMemoryCopy(u32 dest, u32 src, int size, GPUCopyFlag flags = GPUCopyFlag::NONE) override;
|
||||||
|
|
|
@ -9,8 +9,10 @@
|
||||||
#include "Core/Config.h"
|
#include "Core/Config.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
#include "GPU/GPU.h"
|
#include "GPU/GPU.h"
|
||||||
|
#include "GPU/GPUInterface.h"
|
||||||
// TODO: This should be moved here or to Common, doesn't belong in /GPU
|
// TODO: This should be moved here or to Common, doesn't belong in /GPU
|
||||||
#include "GPU/Vulkan/DebugVisVulkan.h"
|
#include "GPU/Vulkan/DebugVisVulkan.h"
|
||||||
|
#include "GPU/Common/FramebufferManagerCommon.h"
|
||||||
|
|
||||||
// For std::max
|
// For std::max
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -174,6 +176,27 @@ static void DrawFrameTiming(UIContext *ctx, const Bounds &bounds) {
|
||||||
ctx->RebindTexture();
|
ctx->RebindTexture();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawFramebufferList(UIContext *ctx, GPUInterface *gpu, const Bounds &bounds) {
|
||||||
|
if (!gpu) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
FontID ubuntu24("UBUNTU24");
|
||||||
|
auto list = gpu->GetFramebufferList();
|
||||||
|
ctx->Flush();
|
||||||
|
ctx->BindFontTexture();
|
||||||
|
ctx->Draw()->SetFontScale(0.7f, 0.7f);
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
for (const VirtualFramebuffer *vfb : list) {
|
||||||
|
char buf[512];
|
||||||
|
snprintf(buf, sizeof(buf), "%08x (Z %08x): %dx%d (stride %d, %d)",
|
||||||
|
vfb->fb_address, vfb->z_address, vfb->width, vfb->height, vfb->fb_stride, vfb->z_stride);
|
||||||
|
ctx->Draw()->DrawTextRect(ubuntu24, buf, bounds.x + 10, bounds.y + 20 + i * 50, bounds.w - 20, bounds.h - 30, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
ctx->Flush();
|
||||||
|
}
|
||||||
|
|
||||||
void DrawControlMapperOverlay(UIContext *ctx, const Bounds &bounds, const ControlMapper &controlMapper) {
|
void DrawControlMapperOverlay(UIContext *ctx, const Bounds &bounds, const ControlMapper &controlMapper) {
|
||||||
DrawControlDebug(ctx, controlMapper, ctx->GetLayoutBounds());
|
DrawControlDebug(ctx, controlMapper, ctx->GetLayoutBounds());
|
||||||
}
|
}
|
||||||
|
@ -208,6 +231,10 @@ void DrawDebugOverlay(UIContext *ctx, const Bounds &bounds, DebugOverlay overlay
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case DebugOverlay::FRAMEBUFFER_LIST:
|
||||||
|
if (inGame)
|
||||||
|
DrawFramebufferList(ctx, gpu, bounds);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,6 +102,7 @@ static const char *g_debugOverlayList[] = {
|
||||||
"Audio Debug",
|
"Audio Debug",
|
||||||
"GPU Profile",
|
"GPU Profile",
|
||||||
"GPU Allocator Viewer",
|
"GPU Allocator Viewer",
|
||||||
|
"Framebuffer List",
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddOverlayList(UI::ViewGroup *items, ScreenManager *screenManager) {
|
void AddOverlayList(UI::ViewGroup *items, ScreenManager *screenManager) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue