Remove the GPUDebugInterface class

Just a pointless extra layer in the class hiearchy, making it
unnecessarily hard to modify the interface.

Might as well hit GPUCommon directly.
This commit is contained in:
Henrik Rydgård
2026-06-02 11:15:08 +02:00
parent eaadb8aa31
commit a317890c08
47 changed files with 281 additions and 360 deletions
+3 -3
View File
@@ -32,7 +32,7 @@ extern "C" {
#include "Core/System.h"
#include "Core/Screenshot.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "Core/ELF/ParamSFO.h"
#include "Core/HLE/sceKernelTime.h"
@@ -195,11 +195,11 @@ void AVIDump::AddFrame() {
u32 w = 0;
u32 h = 0;
if (g_Config.bDumpVideoOutput) {
gpuDebug->GetOutputFramebuffer(buf);
gpu->GetOutputFramebuffer(buf);
w = buf.GetStride();
h = buf.GetHeight();
} else {
gpuDebug->GetCurrentFramebuffer(buf, GPU_DBG_FRAMEBUF_RENDER);
gpu->GetCurrentFramebuffer(buf, GPU_DBG_FRAMEBUF_RENDER);
w = PSP_CoreParameter().renderWidth;
h = PSP_CoreParameter().renderHeight;
}
@@ -22,7 +22,7 @@
#include "Core/System.h"
#include "GPU/Debugger/Record.h"
#include "GPU/GPU.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
struct WebSocketGPURecordState : public DebuggerSubscriber {
~WebSocketGPURecordState();
@@ -46,7 +46,7 @@ DebuggerSubscriber *WebSocketGPURecordInit(DebuggerEventHandlerMap &map) {
WebSocketGPURecordState::~WebSocketGPURecordState() {
// Clear the callback to hopefully avoid a crash.
if (pending_)
gpuDebug->GetRecorder()->ClearCallback();
gpu->GetRecorder()->ClearCallback();
}
// Begin recording (gpu.record.dump)
@@ -62,7 +62,7 @@ void WebSocketGPURecordState::Dump(DebuggerRequest &req) {
return req.Fail("CPU not started");
}
bool result = gpuDebug->GetRecorder()->RecordNextFrame([=](const Path &filename) {
bool result = gpu->GetRecorder()->RecordNextFrame([=](const Path &filename) {
lastFilename_ = filename;
pending_ = false;
});
+1 -1
View File
@@ -692,7 +692,7 @@ void __DisplayFlip(int cyclesLate) {
// 4 here means 1 drawn, 4 skipped - so 12 fps minimum.
maxFrameskip = frameSkipNum;
}
if (numSkippedFrames >= maxFrameskip || gpuDebug->GetRecorder()->IsActivePending()) {
if (numSkippedFrames >= maxFrameskip || gpu->GetRecorder()->IsActivePending()) {
skipFrame = false;
}
+3 -3
View File
@@ -39,7 +39,7 @@
#include "Core/ELF/ParamSFO.h"
#include "Core/System.h"
#include "Core/Core.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/FramebufferManagerCommon.h"
#include "GPU/GPUCommon.h"
@@ -374,7 +374,7 @@ bool ScreenshotNotifyPostGameRender(Draw::DrawContext *draw) {
}
GPUDebugBuffer buf;
if (!gpuDebug) {
if (!gpu) {
ERROR_LOG(Log::System, "Can't take screenshots when GPU not running");
g_pendingScreenshot.callback(ScreenshotResult::ScreenshotNotPossible);
g_pendingScreenshot = {};
@@ -383,7 +383,7 @@ bool ScreenshotNotifyPostGameRender(Draw::DrawContext *draw) {
const int maxRes = g_pendingScreenshot.maxRes;
if (!gpuDebug->GetCurrentFramebuffer(buf, g_pendingScreenshot.type == ScreenshotType::Render ? GPU_DBG_FRAMEBUF_RENDER : GPU_DBG_FRAMEBUF_DISPLAY, maxRes)) {
if (!gpu->GetCurrentFramebuffer(buf, g_pendingScreenshot.type == ScreenshotType::Render ? GPU_DBG_FRAMEBUF_RENDER : GPU_DBG_FRAMEBUF_DISPLAY, maxRes)) {
g_pendingScreenshot.callback(ScreenshotResult::ScreenshotNotPossible);
g_pendingScreenshot = {};
return false;
+1 -1
View File
@@ -745,7 +745,7 @@ BootState PollBootState() {
void PSP_Shutdown(bool success) {
// Reduce the risk for weird races with the Windows GE debugger.
gpuDebug = nullptr;
gpu = nullptr;
// Do nothing if we never inited.
if (g_bootState == BootState::Off) {
+6 -6
View File
@@ -19,7 +19,7 @@
#include "Common/Math/expression_parser.h"
#include "Common/StringUtils.h"
#include "Core/Debugger/SymbolMap.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/GPUCommon.h"
#include "GPU/Debugger/GECommandTable.h"
#include "GPU/GPUState.h"
@@ -511,7 +511,7 @@ static constexpr GECmdConstant constantNames[] = {
class GEExpressionFunctions : public IExpressionFunctions {
public:
GEExpressionFunctions(GPUDebugInterface *gpu) : gpu_(gpu) {}
GEExpressionFunctions(GPUCommon *gpu) : gpu_(gpu) {}
bool parseReference(char *str, uint32_t &referenceIndex) override;
bool parseSymbol(char *str, uint32_t &symbolValue) override;
@@ -524,7 +524,7 @@ private:
static uint32_t getFieldValue(GECmdFormat fmt, GECmdField field, uint32_t value);
static ExpressionType getFieldType(GECmdFormat fmt, GECmdField field);
GPUDebugInterface *gpu_;
GPUCommon *gpu_;
};
bool GEExpressionFunctions::parseReference(char *str, uint32_t &referenceIndex) {
@@ -951,17 +951,17 @@ bool GEExpressionFunctions::getMemoryValue(uint32_t address, int size, uint32_t
return false;
}
bool GPUDebugInitExpression(GPUDebugInterface *g, const char *str, PostfixExpression &exp) {
bool GPUDebugInitExpression(GPUCommon *g, const char *str, PostfixExpression &exp) {
GEExpressionFunctions funcs(g);
return initPostfixExpression(str, &funcs, exp);
}
bool GPUDebugExecExpression(GPUDebugInterface *g, PostfixExpression &exp, uint32_t &result) {
bool GPUDebugExecExpression(GPUCommon *g, PostfixExpression &exp, uint32_t &result) {
GEExpressionFunctions funcs(g);
return parsePostfixExpression(exp, &funcs, result);
}
bool GPUDebugExecExpression(GPUDebugInterface *g, const char *str, uint32_t &result) {
bool GPUDebugExecExpression(GPUCommon *g, const char *str, uint32_t &result) {
GEExpressionFunctions funcs(g);
return parseExpression(str, &funcs, result);
}
+4 -92
View File
@@ -215,96 +215,8 @@ struct GPUDebugVertex {
};
class StringWriter;
class GPUCommon;
// TODO: This interface is somewhat pointless. GPUCommon could be the base class.
class GPUDebugInterface {
public:
virtual ~GPUDebugInterface() = default;
virtual bool GetCurrentDisplayList(DisplayList &list) = 0;
virtual int GetCurrentPrimCount() = 0;
virtual std::vector<DisplayList> ActiveDisplayLists() = 0;
virtual void ResetListPC(int listID, u32 pc) = 0;
virtual void ResetListStall(int listID, u32 stall) = 0;
virtual void ResetListState(int listID, DisplayListState state) = 0;
virtual GPUDebugOp DisassembleOp(u32 pc, u32 op) = 0;
virtual std::vector<GPUDebugOp> DisassembleOpRange(u32 startpc, u32 endpc) = 0;
virtual u32 GetRelativeAddress(u32 data) = 0;
virtual u32 GetVertexAddress() = 0;
virtual u32 GetIndexAddress() = 0;
virtual const GPUgstate &GetGState() = 0;
// Needs to be called from the GPU thread.
// Calling from a separate thread (e.g. UI) may fail.
virtual void SetCmdValue(u32 op) = 0;
virtual void Flush() = 0;
virtual void GetStats(StringWriter &w) = 0;
virtual uint32_t SetAddrTranslation(uint32_t value) = 0;
virtual uint32_t GetAddrTranslation() = 0;
// TODO: Make a proper debug interface instead of accessing directly?
virtual FramebufferManagerCommon *GetFramebufferManagerCommon() = 0;
virtual TextureCacheCommon *GetTextureCacheCommon() = 0;
virtual std::vector<const VirtualFramebuffer *> GetFramebufferList() const = 0;
virtual std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) = 0;
virtual std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) = 0;
virtual bool DescribeCodePtr(const u8 *ptr, std::string &name) = 0;
virtual const std::list<int> &GetDisplayListQueue() = 0;
virtual const DisplayList &GetDisplayList(int index) = 0;
virtual int PrimsThisFrame() const = 0;
virtual int PrimsLastFrame() const = 0;
virtual void ClearBreakNext() = 0;
virtual void SetBreakNext(GPUDebug::BreakNext next) = 0 ;
virtual void SetBreakCount(int c, bool relative = false) = 0 ;
virtual GPUDebug::BreakNext GetBreakNext() const = 0;
virtual int GetBreakCount() const = 0;
virtual bool SetRestrictPrims(std::string_view rule) = 0 ;
virtual std::string_view GetRestrictPrims() = 0;
virtual GPURecord::Recorder *GetRecorder() = 0;
virtual GPUBreakpoints *GetBreakpoints() = 0;
virtual bool GetCurrentDrawAsDebugVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices) {
return false;
}
// Needs to be called from the GPU thread, so on the same thread as a notification is fine.
// Calling from a separate thread (e.g. UI) may fail.
virtual bool GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferType type, int maxRes = -1) {
// False means unsupported.
return false;
}
// Similar to GetCurrentFramebuffer().
virtual bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) {
return false;
}
// Similar to GetCurrentFramebuffer().
virtual bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) {
return false;
}
// Similar to GetCurrentFramebuffer(), with texture level specification.
virtual bool GetCurrentTexture(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) {
return false;
}
virtual bool GetCurrentClut(GPUDebugBuffer &buffer) {
return false;
}
virtual bool GetOutputFramebuffer(GPUDebugBuffer &buffer) {
return false;
}
};
bool GPUDebugInitExpression(GPUDebugInterface *g, const char *str, PostfixExpression &exp);
bool GPUDebugExecExpression(GPUDebugInterface *g, PostfixExpression &exp, uint32_t &result);
bool GPUDebugExecExpression(GPUDebugInterface *g, const char *str, uint32_t &result);
bool GPUDebugInitExpression(GPUCommon *g, const char *str, PostfixExpression &exp);
bool GPUDebugExecExpression(GPUCommon *g, PostfixExpression &exp, uint32_t &result);
bool GPUDebugExecExpression(GPUCommon *g, const char *str, uint32_t &result);
+1 -1
View File
@@ -22,7 +22,7 @@
#include "Common/Math/lin/matrix4x4.h"
#include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/TransformCommon.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
class FramebufferManagerCommon;
class TextureCacheCommon;
+1 -1
View File
@@ -25,7 +25,7 @@
#include "Common/MemoryUtil.h"
#include "Core/System.h"
#include "GPU/GPU.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/TextureDecoder.h"
#include "GPU/Common/TextureScalerCommon.h"
#include "GPU/Common/TextureShaderCommon.h"
+2 -2
View File
@@ -153,7 +153,7 @@ static bool HitBreakpointCond(GPUBreakpoints::BreakpointInfo &bp, u32 op) {
gstate.cmdmem[cmd] ^= diff;
u32 result = 1;
if (!GPUDebugExecExpression(gpuDebug, bp.expression, result))
if (!GPUDebugExecExpression(gpu, bp.expression, result))
result = 0;
gstate.cmdmem[cmd] ^= diff;
@@ -435,7 +435,7 @@ void GPUBreakpoints::RemoveTextureChangeTempBreakpoint() {
static bool SetupCond(GPUBreakpoints::BreakpointInfo &bp, const std::string &expression, std::string *error) {
bool success = true;
if (expression.length() != 0) {
if (GPUDebugInitExpression(gpuDebug, expression.c_str(), bp.expression)) {
if (GPUDebugInitExpression(gpu, expression.c_str(), bp.expression)) {
bp.isConditional = true;
bp.expressionString = expression;
} else {
+1 -1
View File
@@ -963,7 +963,7 @@ void WriteRunDumpCode(u32 codeStart) {
// A long term goal is inversion of control here, but it's tricky for a number of reasons that you'll find
// out if you try.
ReplayResult RunMountedReplay(const std::string &filename) {
_assert_msg_(!gpuDebug->GetRecorder()->IsActivePending(), "Cannot run replay while recording.");
_assert_msg_(!gpu->GetRecorder()->IsActivePending(), "Cannot run replay while recording.");
uint32_t version = lastExecVersion;
if (lastExecFilename != filename) {
+5 -5
View File
@@ -37,7 +37,7 @@
#include "Core/HLE/sceDisplay.h"
#include "Core/MemMap.h"
#include "Core/System.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/GPUCommon.h"
#include "GPU/GPUState.h"
#include "GPU/ge_constants.h"
@@ -147,7 +147,7 @@ bool Recorder::BeginRecording() {
// Also save the initial CLUT.
GPUDebugBuffer clut;
if (gpuDebug->GetCurrentClut(clut)) {
if (gpu->GetCurrentClut(clut)) {
sz = clut.GetStride() * clut.PixelSize();
_assert_msg_(sz == 1024, "CLUT should be 1024 bytes");
ptr = (u32)pushbuf.size();
@@ -525,7 +525,7 @@ void Recorder::EmitClut(u32 op) {
// Hardware rendering may be using a framebuffer as CLUT.
// To get at this, we first run the command (normally we're called right before it has run.)
if (Memory::IsVRAMAddress(addr))
gpuDebug->SetCmdValue(op);
gpu->SetCmdValue(op);
// Actually should only be 0x3F, but we allow enhanced CLUTs. See #15727.
u32 blocks = (op & 0x7F) == 0x40 ? 0x40 : (op & 0x3F);
@@ -608,10 +608,10 @@ void Recorder::FinishRecording() {
}
void Recorder::CheckEdramTrans() {
if (!gpuDebug)
if (!gpu)
return;
uint32_t value = gpuDebug->GetAddrTranslation();
uint32_t value = gpu->GetAddrTranslation();
if (value == lastEdramTrans)
return;
lastEdramTrans = value;
+13 -13
View File
@@ -6,13 +6,13 @@
#include "GPU/Debugger/State.h"
#include "GPU/GPU.h"
#include "GPU/Common/GPUStateUtils.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/GeDisasm.h"
#include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/SplineCommon.h"
#include "Core/System.h"
void FormatStateRow(GPUDebugInterface *gpudebug, char *dest, size_t destSize, CmdFormatType fmt, u32 value, bool enabled, u32 otherValue, u32 otherValue2) {
void FormatStateRow(GPUCommon *gpudebug, char *dest, size_t destSize, CmdFormatType fmt, u32 value, bool enabled, u32 otherValue, u32 otherValue2) {
value &= 0xFFFFFF;
otherValue &= 0xFFFFFF;
otherValue2 &= 0xFFFFFF;
@@ -188,15 +188,15 @@ void FormatStateRow(GPUDebugInterface *gpudebug, char *dest, size_t destSize, Cm
break;
case CMD_FMT_OFFSETADDR:
snprintf(dest, destSize, "%08x", gpuDebug->GetRelativeAddress(0));
snprintf(dest, destSize, "%08x", gpu->GetRelativeAddress(0));
break;
case CMD_FMT_VADDR:
snprintf(dest, destSize, "%08x", gpuDebug->GetVertexAddress());
snprintf(dest, destSize, "%08x", gpu->GetVertexAddress());
break;
case CMD_FMT_IADDR:
snprintf(dest, destSize, "%08x", gpuDebug->GetIndexAddress());
snprintf(dest, destSize, "%08x", gpu->GetIndexAddress());
break;
case CMD_FMT_MATERIALUPDATE:
@@ -571,7 +571,7 @@ void FormatVertColRaw(VertexDecoder *decoder, char *dest, size_t destSize, int r
// We could use the vertex decoder and reader, but those already do some minor adjustments.
// There's only a few values - let's just go after them directly.
const u8 *vert = Memory::GetPointer(gpuDebug->GetVertexAddress()) + row * decoder->size;
const u8 *vert = Memory::GetPointer(gpu->GetVertexAddress()) + row * decoder->size;
const u8 *pos = vert + decoder->posoff;
const u8 *tc = vert + decoder->tcoff;
const u8 *color = vert + decoder->coloff;
@@ -855,7 +855,7 @@ bool GetPrimPreview(u32 op, GEPrimitiveType &prim, std::vector<GPUDebugVertex> &
ERROR_LOG(Log::G3D, "Unsupported prim type: %x", op);
return false;
}
if (!gpuDebug) {
if (!gpu) {
ERROR_LOG(Log::G3D, "Invalid debugging environment, shutting down?");
return false;
}
@@ -865,7 +865,7 @@ bool GetPrimPreview(u32 op, GEPrimitiveType &prim, std::vector<GPUDebugVertex> &
prim = static_cast<GEPrimitiveType>(prim_type);
if (!gpuDebug->GetCurrentDrawAsDebugVertices(count, vertices, indices)) {
if (!gpu->GetCurrentDrawAsDebugVertices(count, vertices, indices)) {
ERROR_LOG(Log::G3D, "Vertex preview not yet supported");
return false;
}
@@ -901,7 +901,7 @@ bool GetPrimPreview(u32 op, GEPrimitiveType &prim, std::vector<GPUDebugVertex> &
}
if (prim == GE_PRIM_RECTANGLES) {
ExpandRectangles(vertices, indices, count, gpuDebug->GetGState().isModeThrough());
ExpandRectangles(vertices, indices, count, gpu->GetGState().isModeThrough());
}
// TODO: Probably there's a better way and place to do this.
@@ -929,10 +929,10 @@ bool GetPrimPreview(u32 op, GEPrimitiveType &prim, std::vector<GPUDebugVertex> &
}
};
const float invTexWidth = 1.0f / gpuDebug->GetGState().getTextureWidth(0);
const float invTexHeight = 1.0f / gpuDebug->GetGState().getTextureHeight(0);
bool clampS = gpuDebug->GetGState().isTexCoordClampedS();
bool clampT = gpuDebug->GetGState().isTexCoordClampedT();
const float invTexWidth = 1.0f / gpu->GetGState().getTextureWidth(0);
const float invTexHeight = 1.0f / gpu->GetGState().getTextureHeight(0);
bool clampS = gpu->GetGState().isTexCoordClampedS();
bool clampT = gpu->GetGState().isTexCoordClampedT();
for (u16 i = minIndex; i <= maxIndex; ++i) {
vertices[i].u *= invTexWidth;
vertices[i].v *= invTexHeight;
+3 -3
View File
@@ -8,7 +8,7 @@
#include "GPU/Debugger/GECommandTable.h"
#include "GPU/Common/SplineCommon.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
enum VertexListCols {
VERTEXLIST_COL_X,
@@ -23,7 +23,7 @@ enum VertexListCols {
VERTEXLIST_COL_COUNT,
};
class GPUDebugInterface;
class GPUCommon;
extern const GECommand g_stateFlagsRows[];
extern const GECommand g_stateLightingRows[];
@@ -37,7 +37,7 @@ extern const size_t g_stateSettingsRowsSize;
struct GPUDebugVertex;
class VertexDecoder;
void FormatStateRow(GPUDebugInterface *debug, char *dest, size_t destSize, CmdFormatType fmt, u32 value, bool enabled, u32 otherValue, u32 otherValue2);
void FormatStateRow(GPUCommon *debug, char *dest, size_t destSize, CmdFormatType fmt, u32 value, bool enabled, u32 otherValue, u32 otherValue2);
void FormatVertCol(char *dest, size_t destSize, const GPUDebugVertex &vert, int col);
void FormatVertColRaw(VertexDecoder *decoder, char *dest, size_t destSize, int row, int col);
+11 -11
View File
@@ -22,7 +22,7 @@
#include "Common/Thread/ThreadUtil.h"
#include "Core/Core.h"
#include "Core/HW/Display.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Debugger/Stepping.h"
#include "GPU/GPUState.h"
@@ -111,35 +111,35 @@ static void RunPauseAction() {
break;
case PAUSE_GETOUTPUTBUF:
bufferResult = gpuDebug->GetOutputFramebuffer(bufferFrame);
bufferResult = gpu->GetOutputFramebuffer(bufferFrame);
break;
case PAUSE_GETFRAMEBUF:
bufferResult = gpuDebug->GetCurrentFramebuffer(bufferFrame, bufferType);
bufferResult = gpu->GetCurrentFramebuffer(bufferFrame, bufferType);
break;
case PAUSE_GETDEPTHBUF:
bufferResult = gpuDebug->GetCurrentDepthbuffer(bufferDepth);
bufferResult = gpu->GetCurrentDepthbuffer(bufferDepth);
break;
case PAUSE_GETSTENCILBUF:
bufferResult = gpuDebug->GetCurrentStencilbuffer(bufferStencil);
bufferResult = gpu->GetCurrentStencilbuffer(bufferStencil);
break;
case PAUSE_GETTEX:
bufferResult = gpuDebug->GetCurrentTexture(bufferTex, bufferLevel, &lastWasFramebuffer);
bufferResult = gpu->GetCurrentTexture(bufferTex, bufferLevel, &lastWasFramebuffer);
break;
case PAUSE_GETCLUT:
bufferResult = gpuDebug->GetCurrentClut(bufferClut);
bufferResult = gpu->GetCurrentClut(bufferClut);
break;
case PAUSE_SETCMDVALUE:
gpuDebug->SetCmdValue(pauseSetCmdValue);
gpu->SetCmdValue(pauseSetCmdValue);
break;
case PAUSE_FLUSHDRAW:
gpuDebug->Flush();
gpu->Flush();
break;
default:
@@ -159,7 +159,7 @@ void WaitForPauseAction() {
}
bool ProcessStepping() {
_dbg_assert_(gpuDebug);
_dbg_assert_(gpu);
std::unique_lock<std::mutex> guard(pauseLock);
if (coreState != CORE_STEPPING_GE) {
@@ -183,7 +183,7 @@ bool ProcessStepping() {
}
bool EnterStepping(CoreState coreState) {
_dbg_assert_(gpuDebug);
_dbg_assert_(gpu);
std::unique_lock<std::mutex> guard(pauseLock);
if (coreState == CORE_STEPPING_GE) {
+1 -1
View File
@@ -21,7 +21,7 @@
#include "Common/CommonTypes.h"
#include "Core/Core.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/GPUState.h"
namespace GPUStepping {
+1 -1
View File
@@ -22,7 +22,7 @@
#include "Common/GPU/OpenGL/GLRenderManager.h"
#include "GPU/GPUState.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/IndexGenerator.h"
#include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/DrawEngineCommon.h"
+1 -1
View File
@@ -19,7 +19,7 @@
#include "Common/GPU/thin3d.h"
#include "GPU/Common/FramebufferManagerCommon.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
class FramebufferManagerGLES : public FramebufferManagerCommon {
public:
-3
View File
@@ -37,7 +37,6 @@
GPUStatistics gpuStats;
GPUCommon *gpu;
GPUDebugInterface *gpuDebug;
#ifdef USE_CRT_DBG
#undef new
@@ -81,7 +80,6 @@ bool GPU_Init(GPUCore gpuCore, GraphicsContext *ctx, Draw::DrawContext *draw) {
GPUCommon *createdGPU = CreateGPUCore(gpuCore, ctx, draw);
gpu = createdGPU;
gpuDebug = createdGPU;
return gpu != nullptr;
}
@@ -93,7 +91,6 @@ bool GPU_Init(GPUCore gpuCore, GraphicsContext *ctx, Draw::DrawContext *draw) {
void GPU_Shutdown() {
delete gpu;
gpu = nullptr;
gpuDebug = nullptr;
}
const char *RasterChannelToString(RasterChannel channel) {
+2 -2
View File
@@ -24,7 +24,7 @@
enum GPUCore : int;
class GPUCommon;
class GPUDebugInterface;
class GPUCommon;
class GraphicsContext;
// PSP rasterization has two outputs, color and depth. Stencil is packed
@@ -164,7 +164,7 @@ struct GPUStatistics {
extern GPUStatistics gpuStats;
extern GPUCommon *gpu;
extern GPUDebugInterface *gpuDebug;
extern GPUCommon *gpu;
namespace Draw {
class DrawContext;
+56 -44
View File
@@ -13,6 +13,8 @@
#include "GPU/Debugger/Breakpoints.h"
#include "GPU/GPUDefinitions.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/ge_constants.h"
#if defined(__ANDROID__)
#include <atomic>
@@ -36,6 +38,7 @@ namespace Draw {
class DrawContext;
}
class StringWriter;
struct DisplayLayoutConfig;
inline bool IsTrianglePrim(GEPrimitiveType prim) {
@@ -49,16 +52,33 @@ inline bool IsTrianglePrim(GEPrimitiveType prim) {
return prim > GE_PRIM_LINE_STRIP && prim != GE_PRIM_RECTANGLES;
}
class GPUCommon : public GPUDebugInterface {
class GPUCommon {
public:
// The constructor might run on the loader thread.
GPUCommon(GraphicsContext *gfxCtx, Draw::DrawContext *draw);
virtual ~GPUCommon() = default;
virtual void GetStats(StringWriter &w) = 0;
virtual std::vector<const VirtualFramebuffer *> GetFramebufferList() const = 0;
// Needs to be called from the GPU thread, so on the same thread as a notification is fine.
// Calling from a separate thread (e.g. UI) may fail.
virtual bool GetCurrentFramebuffer(GPUDebugBuffer &buffer, GPUDebugFramebufferType type, int maxRes = -1) {
// False means unsupported.
return false;
}
virtual bool GetCurrentDepthbuffer(GPUDebugBuffer &buffer) { return false; }
virtual bool GetCurrentStencilbuffer(GPUDebugBuffer &buffer) { return false; }
virtual bool GetCurrentTexture(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) { return false; }
virtual bool GetCurrentClut(GPUDebugBuffer &buffer) { return false;}
virtual bool GetOutputFramebuffer(GPUDebugBuffer &buffer) { return false; }
bool GetCurrentDisplayList(DisplayList &list);
virtual bool GetCurrentDrawAsDebugVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices);
int GetCurrentPrimCount();
// FinishInitOnMainThread runs on the main thread, of course.
virtual void FinishInitOnMainThread() {}
virtual ~GPUCommon() {}
Draw::DrawContext *GetDrawContext() {
return draw_;
}
@@ -117,8 +137,8 @@ public:
// For example, a debugger is active.
bool ShouldSplitOverGe() const;
uint32_t SetAddrTranslation(uint32_t value) override;
uint32_t GetAddrTranslation() override;
uint32_t SetAddrTranslation(uint32_t value);
uint32_t GetAddrTranslation();
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) = 0;
virtual void SetCurFramebufferDirty(bool dirty) = 0;
@@ -162,7 +182,7 @@ public:
static int EstimatePerVertexCost();
void Flush() override;
virtual void Flush();
#ifdef USE_CRT_DBG
#undef new
@@ -177,46 +197,38 @@ public:
#define new DBG_NEW
#endif
// From GPUDebugInterface.
bool GetCurrentDisplayList(DisplayList &list) override;
bool GetCurrentDrawAsDebugVertices(int count, std::vector<GPUDebugVertex> &vertices, std::vector<u16> &indices) override;
int GetCurrentPrimCount() override;
FramebufferManagerCommon *GetFramebufferManagerCommon() override {
return nullptr;
}
virtual FramebufferManagerCommon *GetFramebufferManagerCommon() { return nullptr; }
virtual TextureCacheCommon *GetTextureCacheCommon() { return nullptr; }
TextureCacheCommon *GetTextureCacheCommon() override {
return nullptr;
}
std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) override { return std::vector<std::string>(); };
std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) override {
virtual std::vector<std::string> DebugGetShaderIDs(DebugShaderType shader) { return std::vector<std::string>(); };
virtual std::string DebugGetShaderString(std::string id, DebugShaderType shader, DebugShaderStringType stringType) {
return "N/A";
}
bool DescribeCodePtr(const u8 *ptr, std::string &name) override;
std::vector<DisplayList> ActiveDisplayLists() override;
void ResetListPC(int listID, u32 pc) override;
void ResetListStall(int listID, u32 stall) override;
void ResetListState(int listID, DisplayListState state) override;
virtual bool DescribeCodePtr(const u8 *ptr, std::string &name);
GPUDebugOp DisassembleOp(u32 pc, u32 op) override;
std::vector<GPUDebugOp> DisassembleOpRange(u32 startpc, u32 endpc) override;
std::vector<DisplayList> ActiveDisplayLists();
void ResetListPC(int listID, u32 pc);
void ResetListStall(int listID, u32 stall);
void ResetListState(int listID, DisplayListState state);
u32 GetRelativeAddress(u32 data) override;
u32 GetVertexAddress() override;
u32 GetIndexAddress() override;
const GPUgstate &GetGState() override;
void SetCmdValue(u32 op) override;
GPUDebugOp DisassembleOp(u32 pc, u32 op);
std::vector<GPUDebugOp> DisassembleOpRange(u32 startpc, u32 endpc);
u32 GetRelativeAddress(u32 data);
u32 GetVertexAddress();
u32 GetIndexAddress();
const GPUgstate &GetGState();
void SetCmdValue(u32 op);
DisplayList* getList(int listid) {
return &dls[listid];
}
const std::list<int> &GetDisplayListQueue() override {
const std::list<int> &GetDisplayListQueue() {
return dlQueue;
}
const DisplayList &GetDisplayList(int index) override {
const DisplayList &GetDisplayList(int index) {
return dls[index];
}
@@ -234,31 +246,31 @@ public:
void PSPFrame();
GPURecord::Recorder *GetRecorder() override {
GPURecord::Recorder *GetRecorder() {
return &recorder_;
}
GPUBreakpoints *GetBreakpoints() override {
GPUBreakpoints *GetBreakpoints() {
return &breakpoints_;
}
void ClearBreakNext() override;
void SetBreakNext(GPUDebug::BreakNext next) override;
void SetBreakCount(int c, bool relative = false) override;
GPUDebug::BreakNext GetBreakNext() const override {
void ClearBreakNext();
void SetBreakNext(GPUDebug::BreakNext next);
void SetBreakCount(int c, bool relative = false);
GPUDebug::BreakNext GetBreakNext() const {
return breakNext_;
}
int GetBreakCount() const override {
int GetBreakCount() const {
return breakAtCount_;
}
bool SetRestrictPrims(std::string_view rule) override;
std::string_view GetRestrictPrims() override {
bool SetRestrictPrims(std::string_view rule);
std::string_view GetRestrictPrims() {
return restrictPrimRule_;
}
int PrimsThisFrame() const override {
int PrimsThisFrame() const {
return primsThisFrame_;
}
int PrimsLastFrame() const override {
int PrimsLastFrame() const {
return primsLastFrame_;
}
+1 -1
View File
@@ -717,7 +717,7 @@ public:
};
class GPUInterface;
class GPUDebugInterface;
class GPUCommon;
extern GPUStateCache gstate_c;
+2 -2
View File
@@ -165,8 +165,8 @@ void ComputeRasterizerState(RasterizerState *state, BinManager *binner) {
#if defined(SOFTGPU_MEMORY_TAGGING_DETAILED) || defined(SOFTGPU_MEMORY_TAGGING_BASIC)
DisplayList currentList{};
if (gpuDebug)
gpuDebug->GetCurrentDisplayList(currentList);
if (gpu)
gpu->GetCurrentDisplayList(currentList);
state->listPC = currentList.pc;
#endif
}
+1 -1
View File
@@ -20,7 +20,7 @@
#include <cstdint>
#include "GPU/GPUCommon.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "Common/GPU/thin3d.h"
struct FormatBuffer {
+1 -1
View File
@@ -19,7 +19,7 @@
#include "CommonTypes.h"
#include "GPU/Common/DrawEngineCommon.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Software/SoftGpu.h"
#include "GPU/Math3D.h"
+2 -2
View File
@@ -42,7 +42,7 @@ bool comparePushBufferNames(const GPUMemoryManager *a, const GPUMemoryManager *b
return strcmp(a->Name(), b->Name()) < 0;
}
void DrawGPUMemoryVis(UIContext *ui, GPUDebugInterface *gpu) {
void DrawGPUMemoryVis(UIContext *ui, GPUCommon *gpu) {
// This one will simply display stats.
Draw::DrawContext *draw = ui->GetDrawContext();
@@ -93,7 +93,7 @@ void DrawGPUMemoryVis(UIContext *ui, GPUDebugInterface *gpu) {
ui->Flush();
}
void DrawGPUProfilerVis(UIContext *ui, GPUDebugInterface *gpu) {
void DrawGPUProfilerVis(UIContext *ui, GPUCommon *gpu) {
using namespace Draw;
const int padding = 10 + System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_LEFT);
const int starty = 50 + System_GetPropertyFloat(SYSPROP_DISPLAY_SAFE_INSET_TOP);
+3 -3
View File
@@ -19,9 +19,9 @@
#include "Common/GPU/thin3d.h"
class GPUDebugInterface;
class GPUCommon;
class UIContext;
// gpu MUST be an instance of GPU_Vulkan. If not, will definitely crash.
void DrawGPUMemoryVis(UIContext *ui, GPUDebugInterface *gpu);
void DrawGPUProfilerVis(UIContext *ui, GPUDebugInterface *gpu);
void DrawGPUMemoryVis(UIContext *ui, GPUCommon *gpu);
void DrawGPUProfilerVis(UIContext *ui, GPUCommon *gpu);
+1 -1
View File
@@ -37,7 +37,7 @@
#include "GPU/Vulkan/VulkanUtil.h"
#include "GPU/GPUState.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/IndexGenerator.h"
#include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/DrawEngineCommon.h"
+1 -1
View File
@@ -210,7 +210,7 @@ static void DrawFrameTiming(UIContext *ctx, const Bounds &bounds) {
ctx->RebindTexture();
}
void DrawFramebufferList(UIContext *ctx, GPUDebugInterface *gpu, const Bounds &bounds) {
void DrawFramebufferList(UIContext *ctx, GPUCommon *gpu, const Bounds &bounds) {
if (!gpu) {
return;
}
+2 -2
View File
@@ -112,10 +112,10 @@ void AddOverlayList(UI::ViewGroup *items, ScreenManager *screenManager) {
}
void SaveFrameDump() {
if (!gpuDebug) {
if (!gpu) {
return;
}
gpuDebug->GetRecorder()->RecordNextFrame([](const Path &dumpPath) {
gpu->GetRecorder()->RecordNextFrame([](const Path &dumpPath) {
NOTICE_LOG(Log::System, "Frame dump created at '%s'", dumpPath.c_str());
if (System_GetPropertyBool(SYSPROP_CAN_SHOW_FILE)) {
System_ShowFileInFolder(dumpPath);
+1 -1
View File
@@ -1929,7 +1929,7 @@ void EmuScreen::runImDebugger() {
1.f
);
}
imDebugger_->Frame(currentDebugMIPS, gpuDebug, draw);
imDebugger_->Frame(currentDebugMIPS, gpu, draw);
// Convert to drawlists.
ImGui::Render();
+3 -3
View File
@@ -59,7 +59,7 @@
#include "Core/MIPS/MIPSStackWalk.h"
// GPU things
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Debugger/Stepping.h"
#include "UI/ImDebugger/ImDebugger.h"
@@ -2312,7 +2312,7 @@ ImDebugger::~ImDebugger() {
cfg_.SaveConfig(ConfigPath());
}
void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebug, Draw::DrawContext *draw) {
void ImDebugger::Frame(MIPSDebugInterface *mipsDebug, GPUCommon *gpuDebug, Draw::DrawContext *draw) {
// Snapshot the coreState to avoid inconsistency.
const CoreState coreState = ::coreState;
@@ -2766,7 +2766,7 @@ void ImDebugger::Snapshot(MIPSState *mips) {
pixelViewer_.Snapshot();
}
void ImDebugger::SnapshotGPU(GPUDebugInterface *gpuDebug) {
void ImDebugger::SnapshotGPU(GPUCommon *gpuDebug) {
pixelViewer_.Snapshot();
}
+3 -3
View File
@@ -31,7 +31,7 @@
// * If windows/objects need state, prefix the class name with Im and just store straight in parent struct
class MIPSDebugInterface;
class GPUDebugInterface;
class GPUCommon;
struct ImConfig;
// Snapshot of the MIPS CPU and other things we want to show diffs off.
@@ -171,12 +171,12 @@ public:
ImDebugger();
~ImDebugger();
void Frame(MIPSDebugInterface *mipsDebug, GPUDebugInterface *gpuDebug, Draw::DrawContext *draw);
void Frame(MIPSDebugInterface *mipsDebug, GPUCommon *gpuDebug, Draw::DrawContext *draw);
// Should be called just before starting a step or run, so that things can
// save state that they can later compare with, to highlight changes.
void Snapshot(MIPSState *mips);
void SnapshotGPU(GPUDebugInterface *mips);
void SnapshotGPU(GPUCommon *mips);
// Call from the outside.
void PostCmd(ImCommand cmd) {
+10 -10
View File
@@ -6,7 +6,7 @@
#include "Common/Data/Text/StringWriter.h"
#include "UI/ImDebugger/ImGe.h"
#include "UI/ImDebugger/ImDebugger.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/FramebufferManagerCommon.h"
#include "GPU/Common/TextureCacheCommon.h"
#include "GPU/Common/VertexDecoderCommon.h"
@@ -289,7 +289,7 @@ void DrawDebugStatsWindow(ImConfig &cfg) {
ImGui::End();
}
void ImGePixelViewerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterface *gpuDebug, Draw::DrawContext *draw) {
void ImGePixelViewerWindow::Draw(ImConfig &cfg, ImControl &control, GPUCommon *gpuDebug, Draw::DrawContext *draw) {
ImGui::SetNextWindowSize(ImVec2(600, 500), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("Pixel Viewer", &cfg.pixelViewerOpen)) {
ImGui::End();
@@ -404,7 +404,7 @@ void ImGePixelViewer::DeviceLost() {
}
}
bool ImGePixelViewer::Draw(GPUDebugInterface *gpuDebug, Draw::DrawContext *draw, float zoom) {
bool ImGePixelViewer::Draw(GPUCommon *gpuDebug, Draw::DrawContext *draw, float zoom) {
if (dirty_) {
UpdateTexture(draw);
dirty_ = false;
@@ -597,7 +597,7 @@ void ImGeReadbackViewer::DeviceLost() {
}
}
bool ImGeReadbackViewer::Draw(GPUDebugInterface *gpuDebug, Draw::DrawContext *draw, float zoom) {
bool ImGeReadbackViewer::Draw(GPUCommon *gpuDebug, Draw::DrawContext *draw, float zoom) {
FramebufferManagerCommon *fbMan = gpuDebug->GetFramebufferManagerCommon();
VirtualFramebuffer *vfb = GetVFB(fbMan);
@@ -683,7 +683,7 @@ bool ImGeReadbackViewer::Draw(GPUDebugInterface *gpuDebug, Draw::DrawContext *dr
}
bool ImGeReadbackViewer::FormatValueAt(char *buf, size_t bufSize, int x, int y) const {
FramebufferManagerCommon *fbMan = gpuDebug->GetFramebufferManagerCommon();
FramebufferManagerCommon *fbMan = gpu->GetFramebufferManagerCommon();
VirtualFramebuffer *vfb = GetVFB(fbMan);
if (!vfb || !vfb->fbo || !data_) {
snprintf(buf, bufSize, "N/A");
@@ -723,7 +723,7 @@ void ImGeDisasmView::NotifyStep() {
}
}
void ImGeDisasmView::Draw(GPUDebugInterface *gpuDebug) {
void ImGeDisasmView::Draw(GPUCommon *gpuDebug) {
const u32 branchColor = 0xFFA0FFFF;
const u32 gteColor = 0xFFFFEFA0;
@@ -1012,7 +1012,7 @@ void ImGeDebuggerWindow::NotifyStep() {
break;
}
FramebufferManagerCommon *fbman = gpuDebug->GetFramebufferManagerCommon();
FramebufferManagerCommon *fbman = gpu->GetFramebufferManagerCommon();
if (fbman) {
rbViewer_.fbAddr = gstate.getFrameBufAddress();
rbViewer_.fbStride = gstate.FrameBufStride();
@@ -1022,7 +1022,7 @@ void ImGeDebuggerWindow::NotifyStep() {
rbViewer_.Snapshot();
}
void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterface *gpuDebug, Draw::DrawContext *draw) {
void ImGeDebuggerWindow::Draw(ImConfig &cfg, ImControl &control, GPUCommon *gpuDebug, Draw::DrawContext *draw) {
ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver);
if (!ImGui::Begin(Title(), &cfg.geDebuggerOpen)) {
ImGui::End();
@@ -1542,7 +1542,7 @@ void ImGeStateWindow::Snapshot() {
}
// TODO: Separate window or merge into Ge debugger?
void ImGeStateWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterface *gpuDebug) {
void ImGeStateWindow::Draw(ImConfig &cfg, ImControl &control, GPUCommon *gpuDebug) {
ImGui::SetNextWindowSize(ImVec2(300, 500), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("GE State", &cfg.geStateOpen)) {
ImGui::End();
@@ -1675,7 +1675,7 @@ void ImGeStateWindow::Draw(ImConfig &cfg, ImControl &control, GPUDebugInterface
ImGui::End();
}
void DrawImGeVertsWindow(ImConfig &cfg, ImControl &control, GPUDebugInterface *gpuDebug) {
void DrawImGeVertsWindow(ImConfig &cfg, ImControl &control, GPUCommon *gpuDebug) {
ImGui::SetNextWindowSize(ImVec2(300, 500), ImGuiCond_FirstUseEver);
if (!ImGui::Begin("GE Vertices", &cfg.geVertsOpen)) {
ImGui::End();
+8 -8
View File
@@ -1,6 +1,6 @@
#pragma once
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
// GE-related windows of the ImDebugger
@@ -20,7 +20,7 @@ void DrawDebugStatsWindow(ImConfig &cfg);
class ImGeDisasmView {
public:
void Draw(GPUDebugInterface *gpuDebug);
void Draw(GPUCommon *gpuDebug);
bool followPC_ = true;
@@ -46,11 +46,11 @@ private:
class ImGeStateWindow {
public:
void Draw(ImConfig &cfg, ImControl &control, GPUDebugInterface *gpuDebug);
void Draw(ImConfig &cfg, ImControl &control, GPUCommon *gpuDebug);
void Snapshot();
};
void DrawImGeVertsWindow(ImConfig &cfg, ImControl &control, GPUDebugInterface *gpuDebug);
void DrawImGeVertsWindow(ImConfig &cfg, ImControl &control, GPUCommon *gpuDebug);
namespace Draw {
class Texture;
@@ -67,7 +67,7 @@ public:
struct ImGePixelViewer : public PixelLookup {
~ImGePixelViewer();
bool Draw(GPUDebugInterface *gpuDebug, Draw::DrawContext *draw, float zoom);
bool Draw(GPUCommon *gpuDebug, Draw::DrawContext *draw, float zoom);
void Snapshot() {
dirty_ = true;
}
@@ -93,7 +93,7 @@ private:
struct ImGeReadbackViewer : public PixelLookup {
ImGeReadbackViewer();
~ImGeReadbackViewer();
bool Draw(GPUDebugInterface *gpuDebug, Draw::DrawContext *draw, float zoom);
bool Draw(GPUCommon *gpuDebug, Draw::DrawContext *draw, float zoom);
void Snapshot() {
dirty_ = true;
}
@@ -120,7 +120,7 @@ private:
class ImGePixelViewerWindow {
public:
void Draw(ImConfig &cfg, ImControl &control, GPUDebugInterface *gpuDebug, Draw::DrawContext *draw);
void Draw(ImConfig &cfg, ImControl &control, GPUCommon *gpuDebug, Draw::DrawContext *draw);
void Snapshot() {
viewer_.Snapshot();
}
@@ -142,7 +142,7 @@ private:
class ImGeDebuggerWindow {
public:
ImGeDebuggerWindow();
void Draw(ImConfig &cfg, ImControl &control, GPUDebugInterface *gpuDebug, Draw::DrawContext *draw);
void Draw(ImConfig &cfg, ImControl &control, GPUCommon *gpuDebug, Draw::DrawContext *draw);
ImGeDisasmView &View() {
return disasmView_;
}
+12 -12
View File
@@ -157,7 +157,7 @@ void CtrlDisplayListView::redraw()
void CtrlDisplayListView::onPaint(WPARAM wParam, LPARAM lParam)
{
if (!validDisplayList || !gpuDebug)
if (!validDisplayList || !gpu)
return;
PAINTSTRUCT ps;
@@ -179,7 +179,7 @@ void CtrlDisplayListView::onPaint(WPARAM wParam, LPARAM lParam)
HICON breakPoint = (HICON)LoadIcon(GetModuleHandle(0),(LPCWSTR)IDI_STOP);
auto disasm = gpuDebug->DisassembleOpRange(windowStart, windowStart + (visibleRows + 2) * instructionSize);
auto disasm = gpu->DisassembleOpRange(windowStart, windowStart + (visibleRows + 2) * instructionSize);
for (int i = 0; i < visibleRows+2; i++)
{
@@ -216,7 +216,7 @@ void CtrlDisplayListView::onPaint(WPARAM wParam, LPARAM lParam)
DeleteObject(backgroundPen);
// display address/symbol
if (gpuDebug->GetBreakpoints()->IsAddressBreakpoint(address))
if (gpu->GetBreakpoints()->IsAddressBreakpoint(address))
{
textColor = 0x0000FF;
int yOffset = std::max(-1,(rowHeight-14+1)/2);
@@ -268,18 +268,18 @@ void CtrlDisplayListView::toggleBreakpoint()
void CtrlDisplayListView::PromptBreakpointCond() {
std::string expression;
gpuDebug->GetBreakpoints()->GetAddressBreakpointCond(curAddress, &expression);
gpu->GetBreakpoints()->GetAddressBreakpointCond(curAddress, &expression);
if (!InputBox_GetString(GetModuleHandle(NULL), wnd, L"Expression", expression, expression))
return;
std::string error;
if (!gpuDebug->GetBreakpoints()->SetAddressBreakpointCond(curAddress, expression, &error))
if (!gpu->GetBreakpoints()->SetAddressBreakpointCond(curAddress, expression, &error))
MessageBox(wnd, ConvertUTF8ToWString(error).c_str(), L"Invalid expression", MB_OK | MB_ICONEXCLAMATION);
}
void CtrlDisplayListView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
{
if (!validDisplayList || !gpuDebug) {
if (!validDisplayList || !gpu) {
return;
}
@@ -310,14 +310,14 @@ void CtrlDisplayListView::onMouseDown(WPARAM wParam, LPARAM lParam, int button)
void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
{
if (!validDisplayList || !gpuDebug) {
if (!validDisplayList || !gpu) {
return;
}
if (button == 2)
{
HMENU menu = GetContextMenu(ContextMenuID::DISPLAYLISTVIEW);
EnableMenuItem(menu, ID_GEDBG_SETCOND, gpuDebug->GetBreakpoints()->IsAddressBreakpoint(curAddress) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(menu, ID_GEDBG_SETCOND, gpu->GetBreakpoints()->IsAddressBreakpoint(curAddress) ? MF_ENABLED : MF_GRAYED);
switch (TriggerContextMenu(ContextMenuID::DISPLAYLISTVIEW, wnd, ContextPoint::FromEvent(lParam)))
{
@@ -341,7 +341,7 @@ void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
for (u32 pos = selectRangeStart; pos < selectRangeEnd && p < end; pos += instructionSize)
{
u32 opcode = Memory::Read_U32(pos);
GPUDebugOp op = gpuDebug->DisassembleOp(pos, opcode);
GPUDebugOp op = gpu->DisassembleOp(pos, opcode);
p += snprintf(p, end - p, "%s\r\n", op.desc.c_str());
}
@@ -358,14 +358,14 @@ void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
break;
case ID_DISASM_SETPCTOHERE:
{
gpuDebug->ResetListPC(list.id,curAddress);
gpu->ResetListPC(list.id,curAddress);
list.pc = curAddress;
redraw();
}
break;
case ID_GEDBG_SETSTALLADDR:
{
gpuDebug->ResetListStall(list.id,curAddress);
gpu->ResetListStall(list.id,curAddress);
list.stall = curAddress;
redraw();
}
@@ -401,7 +401,7 @@ void CtrlDisplayListView::onMouseUp(WPARAM wParam, LPARAM lParam, int button)
break;
}
uint32_t newAddress = curAddress;
if (!GPUDebugExecExpression(gpuDebug, expression.c_str(), newAddress)) {
if (!GPUDebugExecExpression(gpu, expression.c_str(), newAddress)) {
MessageBox(wnd, ConvertUTF8ToWString(getExpressionError()).c_str(), L"Invalid expression", MB_OK | MB_ICONEXCLAMATION);
break;
}
+57 -57
View File
@@ -47,7 +47,7 @@
#include "Windows/main.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/GPUStateUtils.h"
#include "GPU/GPUState.h"
#include "GPU/Debugger/Breakpoints.h"
@@ -84,7 +84,7 @@ static void RemoveDisplayListTab(GEDebuggerTab *tab, TabControl *tabs, GETabPosi
static void UpdateDisplayListTab(GEDebuggerTab *tab, TabControl *tabs, GETabPosition pos, void *ptr) {
CtrlDisplayListView *view = (CtrlDisplayListView *)ptr;
DisplayList list;
if (gpuDebug != nullptr && gpuDebug->GetCurrentDisplayList(list)) {
if (gpu != nullptr && gpu->GetCurrentDisplayList(list)) {
view->setDisplayList(list);
} else {
view->clearDisplayList();
@@ -135,8 +135,8 @@ StepCountDlg::~StepCountDlg() {
void StepCountDlg::Jump(int count, bool relative) {
if (relative && count == 0)
return;
gpuDebug->SetBreakNext(GPUDebug::BreakNext::COUNT);
gpuDebug->SetBreakCount(count, relative);
gpu->SetBreakNext(GPUDebug::BreakNext::COUNT);
gpu->SetBreakCount(count, relative);
};
BOOL StepCountDlg::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
@@ -559,8 +559,8 @@ void CGEDebugger::UpdatePreviews() {
GPUgstate state{};
if (gpuDebug != nullptr) {
state = gpuDebug->GetGState();
if (gpu != nullptr) {
state = gpu->GetGState();
}
updating_ = true;
@@ -578,9 +578,9 @@ void CGEDebugger::UpdatePreviews() {
UpdatePrimPreview(primOp, 3);
}
if (gpuDebug) {
if (gpu) {
wchar_t primCounter[1024]{};
swprintf(primCounter, ARRAY_SIZE(primCounter), L"%d/%d", gpuDebug->PrimsThisFrame(), gpuDebug->PrimsLastFrame());
swprintf(primCounter, ARRAY_SIZE(primCounter), L"%d/%d", gpu->PrimsThisFrame(), gpu->PrimsLastFrame());
SetDlgItemText(m_hDlg, IDC_GEDBG_PRIMCOUNTER, primCounter);
}
@@ -611,7 +611,7 @@ void CGEDebugger::AddTab(GEDebuggerTab *tab, GETabPosition mask) {
tab->state[index].ptr = tab->add(tab, t, pos, m_hInstance, m_hDlg);
tab->pos |= pos;
t->ShowTab(tab->state[index].index, true);
if (gpuDebug)
if (gpu)
tab->update(tab, t, pos, tab->state[index].ptr);
}
};
@@ -683,9 +683,9 @@ void CGEDebugger::UpdatePrimaryPreview(const GPUgstate &state) {
bufferResult = GPU_GetCurrentTexture(primaryBuffer_, textureLevel_, &primaryIsFramebuffer_);
flags = TexturePreviewFlags(state);
if (bufferResult) {
gpuDebug->GetBreakpoints()->UpdateLastTexture(state.getTextureAddress(textureLevel_));
gpu->GetBreakpoints()->UpdateLastTexture(state.getTextureAddress(textureLevel_));
} else {
gpuDebug->GetBreakpoints()->UpdateLastTexture((u32)-1);
gpu->GetBreakpoints()->UpdateLastTexture((u32)-1);
}
} else {
switch (PrimaryDisplayType(fbTabs->CurrentTabIndex())) {
@@ -736,9 +736,9 @@ void CGEDebugger::UpdateSecondPreview(const GPUgstate &state) {
} else {
bufferResult = GPU_GetCurrentTexture(secondBuffer_, textureLevel_, &secondIsFramebuffer_);
if (bufferResult) {
gpuDebug->GetBreakpoints()->UpdateLastTexture(state.getTextureAddress(textureLevel_));
gpu->GetBreakpoints()->UpdateLastTexture(state.getTextureAddress(textureLevel_));
} else {
gpuDebug->GetBreakpoints()->UpdateLastTexture((u32)-1);
gpu->GetBreakpoints()->UpdateLastTexture((u32)-1);
}
}
@@ -763,7 +763,7 @@ void CGEDebugger::UpdateSecondPreview(const GPUgstate &state) {
secondWindow->Clear();
secondBuffer_ = nullptr;
if (gpuDebug == nullptr || state.isTextureMapEnabled()) {
if (gpu == nullptr || state.isTextureMapEnabled()) {
SetDlgItemText(m_hDlg, IDC_GEDBG_TEXADDR, L"Texture: failed");
} else {
SetDlgItemText(m_hDlg, IDC_GEDBG_TEXADDR, L"Texture: disabled");
@@ -785,8 +785,8 @@ void CGEDebugger::PrimaryPreviewHover(int x, int y) {
} else if (x < 0 || y < 0) {
// This means they left the area.
GPUgstate state{};
if (gpuDebug != nullptr) {
state = gpuDebug->GetGState();
if (gpu != nullptr) {
state = gpu->GetGState();
}
DescribePrimaryPreview(state, desc);
} else {
@@ -813,8 +813,8 @@ void CGEDebugger::SecondPreviewHover(int x, int y) {
} else if (x < 0 || y < 0) {
// This means they left the area.
GPUgstate state{};
if (gpuDebug != nullptr) {
state = gpuDebug->GetGState();
if (gpu != nullptr) {
state = gpu->GetGState();
}
DescribeSecondPreview(state, desc);
} else {
@@ -835,8 +835,8 @@ void CGEDebugger::SecondPreviewHover(int x, int y) {
void CGEDebugger::UpdateTextureLevel(int level) {
GPUgstate state{};
if (gpuDebug != nullptr) {
state = gpuDebug->GetGState();
if (gpu != nullptr) {
state = gpu->GetGState();
}
int maxValid = 0;
@@ -967,7 +967,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
{
case IDC_GEDBG_MAINTAB:
tabs->HandleNotify(lParam);
if (gpuDebug != nullptr) {
if (gpu != nullptr) {
for (GEDebuggerTab &tabState : tabStates_) {
if (tabState.type == GETabType::LISTS)
UpdateTab(&tabState);
@@ -985,7 +985,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
break;
case IDC_GEDBG_FBTABS:
fbTabs->HandleNotify(lParam);
if (gpuDebug != nullptr) {
if (gpu != nullptr) {
UpdatePreviews();
}
break;
@@ -999,31 +999,31 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_GEDBG_STEPDRAW:
gpuDebug->SetBreakNext(GPUDebug::BreakNext::DRAW);
gpu->SetBreakNext(GPUDebug::BreakNext::DRAW);
break;
case IDC_GEDBG_STEP:
gpuDebug->SetBreakNext(GPUDebug::BreakNext::OP);
gpu->SetBreakNext(GPUDebug::BreakNext::OP);
break;
case IDC_GEDBG_STEPTEX:
gpuDebug->SetBreakNext(GPUDebug::BreakNext::TEX);
gpu->SetBreakNext(GPUDebug::BreakNext::TEX);
break;
case IDC_GEDBG_STEPFRAME:
gpuDebug->SetBreakNext(GPUDebug::BreakNext::FRAME);
gpu->SetBreakNext(GPUDebug::BreakNext::FRAME);
break;
case IDC_GEDBG_STEPVSYNC:
gpuDebug->SetBreakNext(GPUDebug::BreakNext::VSYNC);
gpu->SetBreakNext(GPUDebug::BreakNext::VSYNC);
break;
case IDC_GEDBG_STEPPRIM:
gpuDebug->SetBreakNext(GPUDebug::BreakNext::PRIM);
gpu->SetBreakNext(GPUDebug::BreakNext::PRIM);
break;
case IDC_GEDBG_STEPCURVE:
gpuDebug->SetBreakNext(GPUDebug::BreakNext::CURVE);
gpu->SetBreakNext(GPUDebug::BreakNext::CURVE);
break;
case IDC_GEDBG_STEPCOUNT:
@@ -1032,17 +1032,17 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case IDC_GEDBG_BREAKTEX:
{
if (!gpuDebug) {
if (!gpu) {
break;
}
const auto state = gpuDebug->GetGState();
const auto state = gpu->GetGState();
u32 texAddr = state.getTextureAddress(textureLevel_);
// TODO: Better interface that allows add/remove or something.
if (InputBox_GetHex(GetModuleHandle(NULL), m_hDlg, L"Texture Address", texAddr, texAddr)) {
if (gpuDebug->GetBreakpoints()->IsTextureBreakpoint(texAddr)) {
gpuDebug->GetBreakpoints()->RemoveTextureBreakpoint(texAddr);
if (gpu->GetBreakpoints()->IsTextureBreakpoint(texAddr)) {
gpu->GetBreakpoints()->RemoveTextureBreakpoint(texAddr);
} else {
gpuDebug->GetBreakpoints()->AddTextureBreakpoint(texAddr);
gpu->GetBreakpoints()->AddTextureBreakpoint(texAddr);
}
}
}
@@ -1050,31 +1050,31 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case IDC_GEDBG_BREAKTARGET:
{
if (!gpuDebug) {
if (!gpu) {
break;
}
const auto state = gpuDebug->GetGState();
const auto state = gpu->GetGState();
u32 fbAddr = state.getFrameBufRawAddress();
// TODO: Better interface that allows add/remove or something.
if (InputBox_GetHex(GetModuleHandle(NULL), m_hDlg, L"Framebuffer Address", fbAddr, fbAddr)) {
if (gpuDebug->GetBreakpoints()->IsRenderTargetBreakpoint(fbAddr)) {
gpuDebug->GetBreakpoints()->RemoveRenderTargetBreakpoint(fbAddr);
if (gpu->GetBreakpoints()->IsRenderTargetBreakpoint(fbAddr)) {
gpu->GetBreakpoints()->RemoveRenderTargetBreakpoint(fbAddr);
} else {
gpuDebug->GetBreakpoints()->AddRenderTargetBreakpoint(fbAddr);
gpu->GetBreakpoints()->AddRenderTargetBreakpoint(fbAddr);
}
}
}
break;
case IDC_GEDBG_TEXLEVELDOWN:
if (gpuDebug != nullptr) {
if (gpu != nullptr) {
UpdateTextureLevel(textureLevel_ - 1);
UpdatePreviews();
}
break;
case IDC_GEDBG_TEXLEVELUP:
if (gpuDebug != nullptr) {
if (gpu != nullptr) {
UpdateTextureLevel(textureLevel_ + 1);
UpdatePreviews();
}
@@ -1088,14 +1088,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
SetDlgItemText(m_hDlg, IDC_GEDBG_TEXADDR, L"");
SetDlgItemText(m_hDlg, IDC_GEDBG_PRIMCOUNTER, L"");
if (gpuDebug) {
gpuDebug->SetBreakNext(GPUDebug::BreakNext::NONE);
if (gpu) {
gpu->SetBreakNext(GPUDebug::BreakNext::NONE);
}
break;
case IDC_GEDBG_RECORD:
if (gpuDebug) {
gpuDebug->GetRecorder()->RecordNextFrame([](const Path &path) {
if (gpu) {
gpu->GetRecorder()->RecordNextFrame([](const Path &path) {
// Opens a Windows Explorer window with the file, when done.
System_ShowFileInFolder(path);
});
@@ -1103,7 +1103,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
break;
case IDC_GEDBG_FLUSH:
if (gpuDebug) {
if (gpu) {
if (!autoFlush_)
GPU_FlushDrawing();
UpdatePreviews();
@@ -1115,14 +1115,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
break;
case IDC_GEDBG_FORCEOPAQUE:
if (gpuDebug) {
if (gpu) {
forceOpaque_ = SendMessage(GetDlgItem(m_hDlg, IDC_GEDBG_FORCEOPAQUE), BM_GETCHECK, 0, 0) != 0;
UpdatePreviews();
}
break;
case IDC_GEDBG_SHOWCLUT:
if (gpuDebug) {
if (gpu) {
showClut_ = SendMessage(GetDlgItem(m_hDlg, IDC_GEDBG_SHOWCLUT), BM_GETCHECK, 0, 0) != 0;
UpdatePreviews();
}
@@ -1131,8 +1131,8 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case IDC_GEDBG_SETPRIMFILTER:
{
std::string value;
if (InputBox_GetString(GetModuleHandle(NULL), m_hDlg, L"Prim counter ranges", gpuDebug->GetRestrictPrims(), value)) {
gpuDebug->SetRestrictPrims(value.c_str());
if (InputBox_GetString(GetModuleHandle(NULL), m_hDlg, L"Prim counter ranges", gpu->GetRestrictPrims(), value)) {
gpu->SetRestrictPrims(value.c_str());
}
break;
}
@@ -1140,24 +1140,24 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
break;
case WM_GEDBG_STEPDISPLAYLIST:
gpuDebug->SetBreakNext(GPUDebug::BreakNext::OP);
gpu->SetBreakNext(GPUDebug::BreakNext::OP);
break;
case WM_GEDBG_TOGGLEPCBREAKPOINT:
{
u32 pc = (u32)wParam;
bool temp;
bool isBreak = gpuDebug->GetBreakpoints()->IsAddressBreakpoint(pc, temp);
bool isBreak = gpu->GetBreakpoints()->IsAddressBreakpoint(pc, temp);
if (isBreak && !temp) {
if (gpuDebug->GetBreakpoints()->GetAddressBreakpointCond(pc, nullptr)) {
if (gpu->GetBreakpoints()->GetAddressBreakpointCond(pc, nullptr)) {
int ret = MessageBox(m_hDlg, L"This breakpoint has a custom condition.\nDo you want to remove it?", L"Confirmation", MB_YESNO);
if (ret == IDYES)
gpuDebug->GetBreakpoints()->RemoveAddressBreakpoint(pc);
gpu->GetBreakpoints()->RemoveAddressBreakpoint(pc);
} else {
gpuDebug->GetBreakpoints()->RemoveAddressBreakpoint(pc);
gpu->GetBreakpoints()->RemoveAddressBreakpoint(pc);
}
} else {
gpuDebug->GetBreakpoints()->AddAddressBreakpoint(pc);
gpu->GetBreakpoints()->AddAddressBreakpoint(pc);
}
}
break;
@@ -1165,7 +1165,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case WM_GEDBG_RUNTOWPARAM:
{
u32 pc = (u32)wParam;
gpuDebug->GetBreakpoints()->AddAddressBreakpoint(pc, true);
gpu->GetBreakpoints()->AddAddressBreakpoint(pc, true);
SendMessage(m_hDlg,WM_COMMAND,IDC_GEDBG_RESUME,0);
}
break;
+1 -1
View File
@@ -19,7 +19,7 @@
#include "Common/Common.h"
#include "Common/CommonWindows.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "Windows/resource.h"
#include "Windows/W32Util/DialogManager.h"
+3 -3
View File
@@ -4,7 +4,7 @@
#include "Windows/MainWindow.h"
#include "Windows/main.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/GPUState.h"
#include "Core/Config.h"
#include <windowsx.h>
@@ -228,9 +228,9 @@ void TabDisplayLists::UpdateSize(WORD width, WORD height)
void TabDisplayLists::Update()
{
if (gpuDebug != NULL)
if (gpu != NULL)
{
lists = gpuDebug->ActiveDisplayLists();
lists = gpu->ActiveDisplayLists();
}
if (activeList != -1)
+22 -22
View File
@@ -33,7 +33,7 @@
#include "GPU/GPUState.h"
#include "GPU/GeDisasm.h"
#include "GPU/Debugger/GECommandTable.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Debugger/Breakpoints.h"
#include "GPU/Debugger/Stepping.h"
#include "GPU/Debugger/State.h"
@@ -304,19 +304,19 @@ void CtrlStateValues::GetColumnText(wchar_t *dest, size_t destSize, int row, int
case STATEVALUES_COL_VALUE:
{
if (!gpuDebug) {
if (!gpu) {
wcscpy(dest, L"N/A");
break;
}
const auto info = GECmdInfoByCmd(rows_[row]);
const auto state = gpuDebug->GetGState();
const auto state = gpu->GetGState();
const bool enabled = info.enableCmd == 0 || (state.cmdmem[info.enableCmd] & 1) == 1;
const u32 value = state.cmdmem[info.cmd] & 0xFFFFFF;
const u32 otherValue = state.cmdmem[info.otherCmd] & 0xFFFFFF;
const u32 otherValue2 = state.cmdmem[info.otherCmd2] & 0xFFFFFF;
char temp[256];
FormatStateRow(gpuDebug, temp, sizeof(temp), info.fmt, value, enabled, otherValue, otherValue2);
FormatStateRow(gpu, temp, sizeof(temp), info.fmt, value, enabled, otherValue, otherValue2);
ConvertUTF8ToWString(dest, destSize, temp);
break;
}
@@ -324,7 +324,7 @@ void CtrlStateValues::GetColumnText(wchar_t *dest, size_t destSize, int row, int
}
void CtrlStateValues::OnDoubleClick(int row, int column) {
if (gpuDebug == nullptr || row >= rowCount_) {
if (gpu == nullptr || row >= rowCount_) {
return;
}
@@ -332,19 +332,19 @@ void CtrlStateValues::OnDoubleClick(int row, int column) {
if (column == STATEVALUES_COL_BREAKPOINT) {
bool proceed = true;
if (gpuDebug->GetBreakpoints()->GetCmdBreakpointCond(info.cmd, nullptr)) {
if (gpu->GetBreakpoints()->GetCmdBreakpointCond(info.cmd, nullptr)) {
int ret = MessageBox(GetHandle(), L"This breakpoint has a custom condition.\nDo you want to remove it?", L"Confirmation", MB_YESNO);
proceed = ret == IDYES;
}
if (proceed)
SetItemState(row, gpuDebug->GetBreakpoints()->ToggleCmdBreakpoint(info) ? 1 : 0);
SetItemState(row, gpu->GetBreakpoints()->ToggleCmdBreakpoint(info) ? 1 : 0);
return;
}
switch (info.fmt) {
case CMD_FMT_FLAG:
{
const auto state = gpuDebug->GetGState();
const auto state = gpu->GetGState();
u32 newValue = state.cmdmem[info.cmd] ^ 1;
SetCmdValue(newValue);
}
@@ -353,7 +353,7 @@ void CtrlStateValues::OnDoubleClick(int row, int column) {
default:
{
char title[1024];
const auto state = gpuDebug->GetGState();
const auto state = gpu->GetGState();
u32 newValue = state.cmdmem[info.cmd] & 0x00FFFFFF;
snprintf(title, sizeof(title), "New value for %s", info.uiName);
@@ -385,21 +385,21 @@ void CtrlStateValues::OnDoubleClick(int row, int column) {
}
void CtrlStateValues::OnRightClick(int row, int column, const POINT &point) {
if (gpuDebug == nullptr) {
if (gpu == nullptr) {
return;
}
const GECommand cmd = rows_[row];
const GECmdInfo &info = GECmdInfoByCmd(cmd);
const auto state = gpuDebug->GetGState();
const auto state = gpu->GetGState();
POINT screenPt(point);
ClientToScreen(GetHandle(), &screenPt);
HMENU subMenu = GetContextMenu(ContextMenuID::GEDBG_STATE);
SetMenuDefaultItem(subMenu, ID_REGLIST_CHANGE, FALSE);
EnableMenuItem(subMenu, ID_GEDBG_SETCOND, gpuDebug->GetBreakpoints()->GPUBreakpoints::IsCmdBreakpoint(info.cmd) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(subMenu, ID_GEDBG_SETCOND, gpu->GetBreakpoints()->GPUBreakpoints::IsCmdBreakpoint(info.cmd) ? MF_ENABLED : MF_GRAYED);
// Ehh, kinda ugly.
if (!watchList.empty() && rows_ == &watchList[0]) {
@@ -417,12 +417,12 @@ void CtrlStateValues::OnRightClick(int row, int column, const POINT &point) {
{
case ID_DISASM_TOGGLEBREAKPOINT: {
bool proceed = true;
if (gpuDebug->GetBreakpoints()->GetCmdBreakpointCond(info.cmd, nullptr)) {
if (gpu->GetBreakpoints()->GetCmdBreakpointCond(info.cmd, nullptr)) {
int ret = MessageBox(GetHandle(), L"This breakpoint has a custom condition.\nDo you want to remove it?", L"Confirmation", MB_YESNO);
proceed = ret == IDYES;
}
if (proceed)
SetItemState(row, gpuDebug->GetBreakpoints()->ToggleCmdBreakpoint(info) ? 1 : 0);
SetItemState(row, gpu->GetBreakpoints()->ToggleCmdBreakpoint(info) ? 1 : 0);
break;
}
@@ -444,7 +444,7 @@ void CtrlStateValues::OnRightClick(int row, int column, const POINT &point) {
const u32 otherValue2 = state.cmdmem[info.otherCmd2] & 0xFFFFFF;
char dest[512];
FormatStateRow(gpuDebug, dest, sizeof(dest), info.fmt, value, enabled, otherValue, otherValue2);
FormatStateRow(gpu, dest, sizeof(dest), info.fmt, value, enabled, otherValue, otherValue2);
System_CopyStringToClipboard(dest);
break;
}
@@ -465,7 +465,7 @@ void CtrlStateValues::OnRightClick(int row, int column, const POINT &point) {
}
bool CtrlStateValues::OnRowPrePaint(int row, LPNMLVCUSTOMDRAW msg) {
if (gpuDebug && RowValuesChanged(row)) {
if (gpu && RowValuesChanged(row)) {
msg->clrText = RGB(255, 0, 0);
return true;
}
@@ -478,10 +478,10 @@ void CtrlStateValues::SetCmdValue(u32 op) {
}
bool CtrlStateValues::RowValuesChanged(int row) {
_assert_(gpuDebug != nullptr && row >= 0 && row < rowCount_);
_assert_(gpu != nullptr && row >= 0 && row < rowCount_);
const auto &info = GECmdInfoByCmd(rows_[row]);
const auto state = gpuDebug->GetGState();
const auto state = gpu->GetGState();
const auto lastState = GPUStepping::LastState();
if (state.cmdmem[info.cmd] != lastState.cmdmem[info.cmd])
@@ -496,18 +496,18 @@ bool CtrlStateValues::RowValuesChanged(int row) {
void CtrlStateValues::PromptBreakpointCond(const GECmdInfo &info) {
std::string expression;
gpuDebug->GetBreakpoints()->GetCmdBreakpointCond(info.cmd, &expression);
gpu->GetBreakpoints()->GetCmdBreakpointCond(info.cmd, &expression);
if (!InputBox_GetString(GetModuleHandle(NULL), GetHandle(), L"Expression", expression, expression))
return;
std::string error;
if (!gpuDebug->GetBreakpoints()->SetCmdBreakpointCond(info.cmd, expression, &error)) {
if (!gpu->GetBreakpoints()->SetCmdBreakpointCond(info.cmd, expression, &error)) {
MessageBox(GetHandle(), ConvertUTF8ToWString(error).c_str(), L"Invalid expression", MB_OK | MB_ICONEXCLAMATION);
} else {
if (info.otherCmd)
gpuDebug->GetBreakpoints()->SetCmdBreakpointCond(info.otherCmd, expression, &error);
gpu->GetBreakpoints()->SetCmdBreakpointCond(info.otherCmd, expression, &error);
if (info.otherCmd2)
gpuDebug->GetBreakpoints()->SetCmdBreakpointCond(info.otherCmd2, expression, &error);
gpu->GetBreakpoints()->SetCmdBreakpointCond(info.otherCmd2, expression, &error);
}
}
+19 -19
View File
@@ -29,7 +29,7 @@
#include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/GPUState.h"
#include "GPU/GeDisasm.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Debugger/Breakpoints.h"
#include "GPU/Debugger/Stepping.h"
#include "GPU/Debugger/State.h"
@@ -161,16 +161,16 @@ int CtrlVertexList::GetRowCount() {
return 0;
}
if (!gpuDebug || !Memory::IsValidAddress(gpuDebug->GetVertexAddress())) {
if (!gpu || !Memory::IsValidAddress(gpu->GetVertexAddress())) {
rowCount_ = 0;
return rowCount_;
}
// TODO: Maybe there are smarter ways? Also, is this the best place to recalc?
auto state = gpuDebug->GetGState();
auto state = gpu->GetGState();
rowCount_ = gpuDebug->GetCurrentPrimCount();
if (!gpuDebug->GetCurrentDrawAsDebugVertices(rowCount_, vertices, indices)) {
rowCount_ = gpu->GetCurrentPrimCount();
if (!gpu->GetCurrentDrawAsDebugVertices(rowCount_, vertices, indices)) {
rowCount_ = 0;
}
VertexDecoderOptions options{};
@@ -244,7 +244,7 @@ CtrlMatrixList::CtrlMatrixList(HWND hwnd)
}
bool CtrlMatrixList::OnColPrePaint(int row, int col, LPNMLVCUSTOMDRAW msg) {
const auto state = gpuDebug->GetGState();
const auto state = gpu->GetGState();
const auto lastState = GPUStepping::LastState();
bool changed = false;
@@ -288,7 +288,7 @@ bool CtrlMatrixList::ColChanged(const GPUgstate &lastState, const GPUgstate &sta
}
bool CtrlMatrixList::GetValue(const GPUgstate &state, int row, int col, float &val) {
if (!gpuDebug || row < 0 || row >= MATRIXLIST_ROW_COUNT || col < 0 || col >= MATRIXLIST_COL_COUNT)
if (!gpu || row < 0 || row >= MATRIXLIST_ROW_COUNT || col < 0 || col >= MATRIXLIST_COL_COUNT)
return false;
if (col < MATRIXLIST_COL_0)
@@ -335,7 +335,7 @@ void CtrlMatrixList::GetColumnText(wchar_t *dest, size_t destSize, int row, int
}
float val;
if (!GetValue(gpuDebug->GetGState(), row, col, val)) {
if (!GetValue(gpu->GetGState(), row, col, val)) {
wcscpy(dest, L"Invalid");
return;
}
@@ -400,7 +400,7 @@ void CtrlMatrixList::GetColumnText(wchar_t *dest, size_t destSize, int row, int
}
int CtrlMatrixList::GetRowCount() {
if (!gpuDebug) {
if (!gpu) {
return 0;
}
@@ -437,16 +437,16 @@ void CtrlMatrixList::ToggleBreakpoint(int row) {
return;
// Okay, this command is in range. Toggle the actual breakpoint.
bool state = !gpuDebug->GetBreakpoints()->IsCmdBreakpoint(info->cmd);
bool state = !gpu->GetBreakpoints()->IsCmdBreakpoint(info->cmd);
if (state) {
gpuDebug->GetBreakpoints()->AddCmdBreakpoint(info->cmd);
gpu->GetBreakpoints()->AddCmdBreakpoint(info->cmd);
} else {
if (gpuDebug->GetBreakpoints()->GetCmdBreakpointCond(info->cmd, nullptr)) {
if (gpu->GetBreakpoints()->GetCmdBreakpointCond(info->cmd, nullptr)) {
int ret = MessageBox(GetHandle(), L"This breakpoint has a custom condition.\nDo you want to remove it?", L"Confirmation", MB_YESNO);
if (ret != IDYES)
return;
}
gpuDebug->GetBreakpoints()->RemoveCmdBreakpoint(info->cmd);
gpu->GetBreakpoints()->RemoveCmdBreakpoint(info->cmd);
}
for (int r = info->row; r < (info + 1)->row; ++r) {
@@ -460,12 +460,12 @@ void CtrlMatrixList::PromptBreakpointCond(int row) {
return;
std::string expression;
gpuDebug->GetBreakpoints()->GetCmdBreakpointCond(info->cmd, &expression);
gpu->GetBreakpoints()->GetCmdBreakpointCond(info->cmd, &expression);
if (!InputBox_GetString(GetModuleHandle(NULL), GetHandle(), L"Expression", expression, expression))
return;
std::string error;
if (!gpuDebug->GetBreakpoints()->SetCmdBreakpointCond(info->cmd, expression, &error))
if (!gpu->GetBreakpoints()->SetCmdBreakpointCond(info->cmd, expression, &error))
MessageBox(GetHandle(), ConvertUTF8ToWString(error).c_str(), L"Invalid expression", MB_OK | MB_ICONEXCLAMATION);
}
@@ -479,7 +479,7 @@ void CtrlMatrixList::OnDoubleClick(int row, int column) {
}
float val;
if (!GetValue(gpuDebug->GetGState(), row, column, val))
if (!GetValue(gpu->GetGState(), row, column, val))
return;
std::string strvalue = StringFromFormat("%f", val);
@@ -488,7 +488,7 @@ void CtrlMatrixList::OnDoubleClick(int row, int column) {
return;
if (sscanf(strvalue.c_str(), "%f", &val) == 1) {
auto prevState = gpuDebug->GetGState();
auto prevState = gpu->GetGState();
auto setCmdValue = [&](u32 op) {
SendMessage(GetParent(GetParent(GetHandle())), WM_GEDBG_SETCMDWPARAM, op, 0);
};
@@ -531,7 +531,7 @@ void CtrlMatrixList::OnRightClick(int row, int column, const POINT &point) {
HMENU subMenu = GetContextMenu(ContextMenuID::GEDBG_MATRIX);
SetMenuDefaultItem(subMenu, ID_REGLIST_CHANGE, FALSE);
EnableMenuItem(subMenu, ID_GEDBG_SETCOND, info && gpuDebug->GetBreakpoints()->IsCmdBreakpoint(info->cmd) ? MF_ENABLED : MF_GRAYED);
EnableMenuItem(subMenu, ID_GEDBG_SETCOND, info && gpu->GetBreakpoints()->IsCmdBreakpoint(info->cmd) ? MF_ENABLED : MF_GRAYED);
switch (TriggerContextMenu(ContextMenuID::GEDBG_MATRIX, GetHandle(), ContextPoint::FromClient(point))) {
case ID_DISASM_TOGGLEBREAKPOINT:
@@ -546,7 +546,7 @@ void CtrlMatrixList::OnRightClick(int row, int column, const POINT &point) {
{
// Not really copy instruction, more like copy a float.
float val;
if (GetValue(gpuDebug->GetGState(), row, column, val)) {
if (GetValue(gpu->GetGState(), row, column, val)) {
char dest[128];
snprintf(dest, sizeof(dest), "%f", val);
W32Util::CopyTextToClipboard(GetHandle(), dest);
+1 -1
View File
@@ -18,7 +18,7 @@
#pragma once
#include <vector>
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "Windows/W32Util/DialogManager.h"
#include "Windows/W32Util/Misc.h"
+2 -2
View File
@@ -23,7 +23,7 @@
#include "Core/System.h"
#include "Core/Config.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/SplineCommon.h"
#include "GPU/Debugger/State.h"
#include "GPU/GPUState.h"
@@ -76,7 +76,7 @@ static void BindPreviewProgram(GLSLProgram *&prog) {
u32 CGEDebugger::PrimPreviewOp() {
DisplayList list;
if (gpuDebug != nullptr && gpuDebug->GetCurrentDisplayList(list)) {
if (gpu != nullptr && gpu->GetCurrentDisplayList(list)) {
const u32 op = Memory::Read_U32(list.pc);
const u32 cmd = op >> 24;
if (cmd == GE_CMD_PRIM || cmd == GE_CMD_BEZIER || cmd == GE_CMD_SPLINE) {
+1 -1
View File
@@ -30,7 +30,7 @@
#include "Core/Loaders.h"
#include "GPU/GPUState.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/Common/TextureDecoder.h"
+2 -2
View File
@@ -20,7 +20,7 @@
#include "Common/StringUtils.h"
#include "Core/CoreParameter.h"
#include "Core/System.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "headless/Compare.h"
#include "headless/HeadlessHost.h"
@@ -36,7 +36,7 @@ void HeadlessHost::SendDebugScreenshot(const u8 *pixbuf, u32 w, u32 h) {
const static u32 FRAME_HEIGHT = 272;
GPUDebugBuffer buffer;
gpuDebug->GetCurrentFramebuffer(buffer, GPU_DBG_FRAMEBUF_DISPLAY);
gpu->GetCurrentFramebuffer(buffer, GPU_DBG_FRAMEBUF_DISPLAY);
const std::vector<u32> pixels = TranslateDebugBufferToCompare(&buffer, 512, 272);
ScreenshotComparer comparer(pixels, FRAME_STRIDE, FRAME_WIDTH, FRAME_HEIGHT);
+1 -1
View File
@@ -32,7 +32,7 @@
#include "Core/CoreParameter.h"
#include "Core/System.h"
#include "GPU/Common/GPUDebugInterface.h"
#include "GPU/GPUCommon.h"
#include "GPU/GPUState.h"
#if PPSSPP_API(ANY_GL)
#include "Windows/GPU/WindowsGLContext.h"
+2 -2
View File
@@ -76,8 +76,8 @@ public:
GPUDebugBuffer buf;
u16 w = NATIVEWIDTH;
u16 h = NATIVEHEIGHT;
if (gpuDebug) {
gpuDebug->GetOutputFramebuffer(buf);
if (gpu) {
gpu->GetOutputFramebuffer(buf);
const std::vector<u32> pixels = TranslateDebugBufferToCompare(&buf, w, h);
memcpy(soft_bmp, pixels.data(), SOFT_BMP_SIZE);
}