diff --git a/CMakeLists.txt b/CMakeLists.txt index ff09b4c9bd..b787be7a77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1357,6 +1357,8 @@ set(GPU_SOURCES GPU/Common/SplineCommon.h GPU/Debugger/Breakpoints.cpp GPU/Debugger/Breakpoints.h + GPU/Debugger/Debugger.cpp + GPU/Debugger/Debugger.h GPU/Debugger/Record.cpp GPU/Debugger/Record.h GPU/Debugger/Stepping.cpp diff --git a/Core/Host.h b/Core/Host.h index b06473c4dc..d5b0dc9a7b 100644 --- a/Core/Host.h +++ b/Core/Host.h @@ -51,11 +51,9 @@ public: virtual void SetWindowTitle(const char *message) {} // While debugging is active, it's perfectly fine for these to block. - virtual bool GPUDebuggingActive() { return false; } virtual void GPUNotifyCommand(u32 pc) {} virtual void GPUNotifyDisplay(u32 framebuf, u32 stride, int format) {} virtual void GPUNotifyDraw() {} - virtual void GPUNotifyTextureAttachment(u32 addr) {} virtual bool CanCreateShortcut() {return false;} virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title) {return false;} diff --git a/GPU/Common/TextureCacheCommon.cpp b/GPU/Common/TextureCacheCommon.cpp index 171c0bb297..1409a6b403 100644 --- a/GPU/Common/TextureCacheCommon.cpp +++ b/GPU/Common/TextureCacheCommon.cpp @@ -20,7 +20,6 @@ #include "Common/ColorConv.h" #include "Common/MemoryUtil.h" #include "Core/Config.h" -#include "Core/Host.h" #include "Core/Reporting.h" #include "Core/System.h" #include "GPU/Common/FramebufferCommon.h" @@ -28,6 +27,7 @@ #include "GPU/Common/TextureDecoder.h" #include "GPU/Common/ShaderId.h" #include "GPU/Common/GPUStateUtils.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/GPUState.h" #include "GPU/GPUInterface.h" @@ -708,7 +708,7 @@ void TextureCacheCommon::AttachFramebufferValid(TexCacheEntry *entry, VirtualFra entry->maxLevel = 0; fbTexInfo_[cachekey] = fbInfo; framebuffer->last_frame_attached = gpuStats.numFlips; - host->GPUNotifyTextureAttachment(entry->addr); + GPUDebug::NotifyTextureAttachment(entry->addr); } else if (entry->framebuffer == framebuffer) { framebuffer->last_frame_attached = gpuStats.numFlips; } @@ -727,7 +727,7 @@ void TextureCacheCommon::AttachFramebufferInvalid(TexCacheEntry *entry, VirtualF entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE; entry->maxLevel = 0; fbTexInfo_[cachekey] = fbInfo; - host->GPUNotifyTextureAttachment(entry->addr); + GPUDebug::NotifyTextureAttachment(entry->addr); } } @@ -740,7 +740,7 @@ void TextureCacheCommon::DetachFramebuffer(TexCacheEntry *entry, u32 address, Vi // Otherwise we never recreate the texture. entry->hash ^= 1; fbTexInfo_.erase(cachekey); - host->GPUNotifyTextureAttachment(entry->addr); + GPUDebug::NotifyTextureAttachment(entry->addr); } } diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index fb7b001b7b..eac5cf078f 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -22,7 +22,6 @@ #include "Common/MemoryUtil.h" #include "Core/MemMap.h" -#include "Core/Host.h" #include "Core/System.h" #include "Core/Reporting.h" #include "Core/Config.h" @@ -34,10 +33,10 @@ #include "GPU/Common/TextureDecoder.h" #include "GPU/Common/SplineCommon.h" - #include "GPU/Common/TransformCommon.h" #include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/SoftwareTransformCommon.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/D3D11/FramebufferManagerD3D11.h" #include "GPU/D3D11/TextureCacheD3D11.h" #include "GPU/D3D11/DrawEngineD3D11.h" @@ -690,10 +689,7 @@ rotateVBO: gstate_c.vertBounds.maxU = 0; gstate_c.vertBounds.maxV = 0; -#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP) - // We only support GPU debugging on Windows, and that's the only use case for this. - host->GPUNotifyDraw(); -#endif + GPUDebug::NotifyDraw(); } void DrawEngineD3D11::TessellationDataTransferD3D11::PrepareBuffers(float *&pos, float *&tex, float *&col, int &posStride, int &texStride, int &colStride, int size, bool hasColor, bool hasTexCoords) { diff --git a/GPU/D3D11/GPU_D3D11.cpp b/GPU/D3D11/GPU_D3D11.cpp index 8ad9ebd11a..a23eb2059f 100644 --- a/GPU/D3D11/GPU_D3D11.cpp +++ b/GPU/D3D11/GPU_D3D11.cpp @@ -45,7 +45,6 @@ #include "Core/Debugger/Breakpoints.h" #include "Core/MemMapHelpers.h" #include "Core/MIPS/MIPS.h" -#include "Core/Host.h" #include "Core/Config.h" #include "Core/Reporting.h" #include "Core/System.h" @@ -55,6 +54,7 @@ #include "GPU/GeDisasm.h" #include "GPU/Common/FramebufferCommon.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/D3D11/ShaderManagerD3D11.h" #include "GPU/D3D11/GPU_D3D11.h" #include "GPU/D3D11/FramebufferManagerD3D11.h" @@ -254,7 +254,7 @@ void GPU_D3D11::BeginFrame() { void GPU_D3D11::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) { // TODO: Some games like Spongebob - Yellow Avenger, never change framebuffer, they blit to it. // So breaking on frames doesn't work. Might want to move this to sceDisplay vsync. - host->GPUNotifyDisplay(framebuf, stride, format); + GPUDebug::NotifyDisplay(framebuf, stride, format); framebufferManagerD3D11_->SetDisplayFramebuffer(framebuf, stride, format); } diff --git a/GPU/Debugger/Debugger.cpp b/GPU/Debugger/Debugger.cpp new file mode 100644 index 0000000000..8f2445c512 --- /dev/null +++ b/GPU/Debugger/Debugger.cpp @@ -0,0 +1,48 @@ +// Copyright (c) 2018- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#include "Core/Host.h" +#include "GPU/Debugger/Debugger.h" + +namespace GPUDebug { + +static bool active = false; + +void SetActive(bool flag) { + active = flag; +} + +bool IsActive() { + return active; +} + +void NotifyCommand(u32 pc) { + host->GPUNotifyCommand(pc); +} + +void NotifyDraw() { + host->GPUNotifyDraw(); +} + +void NotifyDisplay(u32 framebuf, u32 stride, int format) { + host->GPUNotifyDisplay(framebuf, stride, format); +} + +void NotifyTextureAttachment(u32 texaddr) { +} + +} diff --git a/GPU/Debugger/Debugger.h b/GPU/Debugger/Debugger.h new file mode 100644 index 0000000000..3c1fe9a062 --- /dev/null +++ b/GPU/Debugger/Debugger.h @@ -0,0 +1,33 @@ +// Copyright (c) 2018- PPSSPP Project. + +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, version 2.0 or later versions. + +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License 2.0 for more details. + +// A copy of the GPL 2.0 should have been included with the program. +// If not, see http://www.gnu.org/licenses/ + +// Official git repository and contact information can be found at +// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. + +#pragma once + +#include "Common/CommonTypes.h" + +namespace GPUDebug { + +void SetActive(bool flag); +bool IsActive(); + +// While debugging is active, these may block. +void NotifyCommand(u32 pc); +void NotifyDraw(); +void NotifyDisplay(u32 framebuf, u32 stride, int format); +void NotifyTextureAttachment(u32 texaddr); + +} diff --git a/GPU/Directx9/DrawEngineDX9.cpp b/GPU/Directx9/DrawEngineDX9.cpp index de1a85d093..e4f24703ee 100644 --- a/GPU/Directx9/DrawEngineDX9.cpp +++ b/GPU/Directx9/DrawEngineDX9.cpp @@ -20,7 +20,6 @@ #include "Common/MemoryUtil.h" #include "Core/MemMap.h" -#include "Core/Host.h" #include "Core/System.h" #include "Core/Reporting.h" #include "Core/Config.h" @@ -36,6 +35,7 @@ #include "GPU/Common/TransformCommon.h" #include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/SoftwareTransformCommon.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/Directx9/TextureCacheDX9.h" #include "GPU/Directx9/DrawEngineDX9.h" #include "GPU/Directx9/ShaderManagerDX9.h" @@ -621,7 +621,7 @@ rotateVBO: gstate_c.vertBounds.maxU = 0; gstate_c.vertBounds.maxV = 0; - host->GPUNotifyDraw(); + GPUDebug::NotifyDraw(); } void DrawEngineDX9::TessellationDataTransferDX9::SendDataToShader(const float * pos, const float * tex, const float * col, int size, bool hasColor, bool hasTexCoords) diff --git a/GPU/Directx9/GPU_DX9.cpp b/GPU/Directx9/GPU_DX9.cpp index afd5a86d10..154a5e44d6 100644 --- a/GPU/Directx9/GPU_DX9.cpp +++ b/GPU/Directx9/GPU_DX9.cpp @@ -39,6 +39,7 @@ #include "GPU/GeDisasm.h" #include "GPU/Common/FramebufferCommon.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/Directx9/ShaderManagerDX9.h" #include "GPU/Directx9/GPU_DX9.h" #include "GPU/Directx9/FramebufferDX9.h" @@ -230,7 +231,7 @@ void GPU_DX9::BeginFrame() { } void GPU_DX9::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) { - host->GPUNotifyDisplay(framebuf, stride, format); + GPUDebug::NotifyDisplay(framebuf, stride, format); framebufferManagerDX9_->SetDisplayFramebuffer(framebuf, stride, format); } diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index 3880edc83b..a8857b17bc 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -20,7 +20,6 @@ #include "Common/MemoryUtil.h" #include "Core/MemMap.h" -#include "Core/Host.h" #include "Core/System.h" #include "Core/Reporting.h" #include "Core/Config.h" @@ -37,6 +36,7 @@ #include "GPU/Common/SplineCommon.h" #include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/SoftwareTransformCommon.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/GLES/FragmentTestCacheGLES.h" #include "GPU/GLES/StateMappingGLES.h" #include "GPU/GLES/TextureCacheGLES.h" @@ -648,9 +648,7 @@ rotateVBO: gstate_c.vertBounds.maxU = 0; gstate_c.vertBounds.maxV = 0; -#ifndef MOBILE_DEVICE - host->GPUNotifyDraw(); -#endif + GPUDebug::NotifyDraw(); } bool DrawEngineGLES::IsCodePtrVertexDecoder(const u8 *ptr) const { diff --git a/GPU/GLES/GPU_GLES.cpp b/GPU/GLES/GPU_GLES.cpp index 5eca0e9296..2a75ead250 100644 --- a/GPU/GLES/GPU_GLES.cpp +++ b/GPU/GLES/GPU_GLES.cpp @@ -35,7 +35,7 @@ #include "GPU/ge_constants.h" #include "GPU/GeDisasm.h" #include "GPU/Common/FramebufferCommon.h" - +#include "GPU/Debugger/Debugger.h" #include "GPU/GLES/ShaderManagerGLES.h" #include "GPU/GLES/GPU_GLES.h" #include "GPU/GLES/FramebufferManagerGLES.h" @@ -443,7 +443,7 @@ void GPU_GLES::BeginFrame() { } void GPU_GLES::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) { - host->GPUNotifyDisplay(framebuf, stride, format); + GPUDebug::NotifyDisplay(framebuf, stride, format); framebufferManagerGL_->SetDisplayFramebuffer(framebuf, stride, format); } diff --git a/GPU/GPU.vcxproj b/GPU/GPU.vcxproj index 296a2081b0..b531442bb8 100644 --- a/GPU/GPU.vcxproj +++ b/GPU/GPU.vcxproj @@ -217,6 +217,7 @@ + @@ -320,6 +321,7 @@ + diff --git a/GPU/GPU.vcxproj.filters b/GPU/GPU.vcxproj.filters index 7dc2f25cad..1710c3f790 100644 --- a/GPU/GPU.vcxproj.filters +++ b/GPU/GPU.vcxproj.filters @@ -273,6 +273,9 @@ Vulkan + + Debugger + @@ -542,5 +545,8 @@ Vulkan + + Debugger + \ No newline at end of file diff --git a/GPU/GPUCommon.cpp b/GPU/GPUCommon.cpp index 69d733835b..fed71166ae 100644 --- a/GPU/GPUCommon.cpp +++ b/GPU/GPUCommon.cpp @@ -28,6 +28,7 @@ #include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/SplineCommon.h" #include "GPU/Common/TextureCacheCommon.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/Debugger/Record.h" const CommonCommandTableEntry commonCommandTable[] = { @@ -933,7 +934,7 @@ bool GPUCommon::InterpretList(DisplayList &list) { gpuState = list.pc == list.stall ? GPUSTATE_STALL : GPUSTATE_RUNNING; debugRecording_ = GPURecord::IsActive(); - const bool useDebugger = host->GPUDebuggingActive() || debugRecording_; + const bool useDebugger = GPUDebug::IsActive() || debugRecording_; const bool useFastRunLoop = !dumpThisFrame_ && !useDebugger; while (gpuState == GPUSTATE_RUNNING) { { @@ -1035,7 +1036,7 @@ void GPUCommon::SlowRunLoop(DisplayList &list) const bool dumpThisFrame = dumpThisFrame_; while (downcount > 0) { - host->GPUNotifyCommand(list.pc); + GPUDebug::NotifyCommand(list.pc); GPURecord::NotifyCommand(list.pc); u32 op = Memory::ReadUnchecked_U32(list.pc); u32 cmd = op >> 24; @@ -1586,10 +1587,8 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) { if (!g_Config.bSoftwareSkinning) vtypeCheckMask = 0xFFFFFFFF; -#ifndef MOBILE_DEVICE - if (debugRecording_ || host->GPUDebuggingActive()) + if (debugRecording_ || GPUDebug::IsActive()) goto bail; -#endif while (src != stall) { uint32_t data = *src; diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index 381a40403a..2673ef4ab2 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -23,7 +23,6 @@ #include "Core/Config.h" #include "Core/ConfigValues.h" #include "Core/Debugger/Breakpoints.h" -#include "Core/Host.h" #include "Core/MemMap.h" #include "Core/HLE/sceKernelInterrupt.h" #include "Core/HLE/sceGe.h" @@ -39,6 +38,7 @@ #include "GPU/Software/TransformUnit.h" #include "GPU/Common/DrawEngineCommon.h" #include "GPU/Common/FramebufferCommon.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/Debugger/Record.h" const int FB_WIDTH = 480; @@ -141,7 +141,7 @@ void SoftGPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat for displayFramebuf_ = (framebuf & 0xFF000000) == 0 ? 0x44000000 | framebuf : framebuf; displayStride_ = stride; displayFormat_ = format; - host->GPUNotifyDisplay(framebuf, stride, format); + GPUDebug::NotifyDisplay(framebuf, stride, format); } // Copies RGBA8 data from RAM to the currently bound render target. diff --git a/GPU/Software/TransformUnit.cpp b/GPU/Software/TransformUnit.cpp index 05f1853119..1d9eef5a13 100644 --- a/GPU/Software/TransformUnit.cpp +++ b/GPU/Software/TransformUnit.cpp @@ -16,13 +16,12 @@ // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #include "Common/MemoryUtil.h" -#include "Core/Host.h" #include "Core/Config.h" #include "GPU/GPUState.h" #include "GPU/Common/DrawEngineCommon.h" #include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/SplineCommon.h" - +#include "GPU/Debugger/Debugger.h" #include "GPU/Software/TransformUnit.h" #include "GPU/Software/Clipper.h" #include "GPU/Software/Lighting.h" @@ -490,7 +489,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy break; } - host->GPUNotifyDraw(); + GPUDebug::NotifyDraw(); } // TODO: This probably is not the best interface. diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index 0da871ba3e..16f0c495fb 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -25,7 +25,6 @@ #include "Common/MemoryUtil.h" #include "Core/MemMap.h" -#include "Core/Host.h" #include "Core/System.h" #include "Core/Reporting.h" #include "Core/Config.h" @@ -44,6 +43,7 @@ #include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/SoftwareTransformCommon.h" #include "GPU/Common/DrawEngineCommon.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/Vulkan/DrawEngineVulkan.h" #include "GPU/Vulkan/TextureCacheVulkan.h" #include "GPU/Vulkan/ShaderManagerVulkan.h" @@ -976,7 +976,7 @@ void DrawEngineVulkan::DoFlush() { gstate_c.vertBounds.maxU = 0; gstate_c.vertBounds.maxV = 0; - host->GPUNotifyDraw(); + GPUDebug::NotifyDraw(); } void DrawEngineVulkan::UpdateUBOs(FrameData *frame) { diff --git a/GPU/Vulkan/GPU_Vulkan.cpp b/GPU/Vulkan/GPU_Vulkan.cpp index 69cd57feb6..18aaa60b2e 100644 --- a/GPU/Vulkan/GPU_Vulkan.cpp +++ b/GPU/Vulkan/GPU_Vulkan.cpp @@ -26,7 +26,6 @@ #include "Core/Config.h" #include "Core/Debugger/Breakpoints.h" #include "Core/MemMapHelpers.h" -#include "Core/Host.h" #include "Core/Config.h" #include "Core/Reporting.h" #include "Core/System.h" @@ -36,7 +35,7 @@ #include "GPU/ge_constants.h" #include "GPU/GeDisasm.h" #include "GPU/Common/FramebufferCommon.h" - +#include "GPU/Debugger/Debugger.h" #include "GPU/Vulkan/ShaderManagerVulkan.h" #include "GPU/Vulkan/GPU_Vulkan.h" #include "GPU/Vulkan/FramebufferVulkan.h" @@ -405,7 +404,7 @@ void GPU_Vulkan::UpdateVsyncInterval(bool force) { } void GPU_Vulkan::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) { - host->GPUNotifyDisplay(framebuf, stride, format); + GPUDebug::NotifyDisplay(framebuf, stride, format); framebufferManager_->SetDisplayFramebuffer(framebuf, stride, format); } diff --git a/UWP/GPU_UWP/GPU_UWP.vcxproj b/UWP/GPU_UWP/GPU_UWP.vcxproj index 0d1bc445ea..f3cfa762bf 100644 --- a/UWP/GPU_UWP/GPU_UWP.vcxproj +++ b/UWP/GPU_UWP/GPU_UWP.vcxproj @@ -332,6 +332,7 @@ + @@ -390,6 +391,7 @@ + diff --git a/UWP/GPU_UWP/GPU_UWP.vcxproj.filters b/UWP/GPU_UWP/GPU_UWP.vcxproj.filters index 641d4feef0..6108deb70b 100644 --- a/UWP/GPU_UWP/GPU_UWP.vcxproj.filters +++ b/UWP/GPU_UWP/GPU_UWP.vcxproj.filters @@ -150,13 +150,18 @@ Debugger + + Debugger + Debugger Common - + + Software + Debugger @@ -291,10 +296,15 @@ Debugger + + Debugger + Debugger - + + Software + Debugger diff --git a/Windows/GEDebugger/GEDebugger.cpp b/Windows/GEDebugger/GEDebugger.cpp index ad68557f64..635ce7d220 100644 --- a/Windows/GEDebugger/GEDebugger.cpp +++ b/Windows/GEDebugger/GEDebugger.cpp @@ -39,6 +39,7 @@ #include "GPU/Common/GPUStateUtils.h" #include "GPU/GPUState.h" #include "GPU/Debugger/Breakpoints.h" +#include "GPU/Debugger/Debugger.h" #include "GPU/Debugger/Record.h" #include "GPU/Debugger/Stepping.h" #include @@ -49,8 +50,6 @@ const int POPUP_SUBMENU_ID_GEDBG_PREVIEW = 10; using namespace GPUBreakpoints; using namespace GPUStepping; -static bool attached = false; - static BreakNextType breakNext = BREAK_NONE; enum PrimaryDisplayType { @@ -627,7 +626,7 @@ void CGEDebugger::SavePosition() } void CGEDebugger::SetBreakNext(BreakNextType type) { - attached = true; + GPUDebug::SetActive(true); SetupPreviews(); breakNext = type; @@ -657,7 +656,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { return TRUE; case WM_CLOSE: - attached = false; + GPUDebug::SetActive(false); ResumeFromStepping(); breakNext = BREAK_NONE; @@ -685,7 +684,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { break; case IDC_GEDBG_FBTABS: fbTabs->HandleNotify(lParam); - if (attached && gpuDebug != nullptr) { + if (GPUDebug::IsActive() && gpuDebug != nullptr) { UpdatePreviews(); } break; @@ -720,7 +719,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { case IDC_GEDBG_BREAKTEX: { - attached = true; + GPUDebug::SetActive(true); if (!gpuDebug) { break; } @@ -739,7 +738,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { case IDC_GEDBG_BREAKTARGET: { - attached = true; + GPUDebug::SetActive(true); if (!gpuDebug) { break; } @@ -758,14 +757,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { case IDC_GEDBG_TEXLEVELDOWN: UpdateTextureLevel(textureLevel_ - 1); - if (attached && gpuDebug != nullptr) { + if (GPUDebug::IsActive() && gpuDebug != nullptr) { UpdatePreviews(); } break; case IDC_GEDBG_TEXLEVELUP: UpdateTextureLevel(textureLevel_ + 1); - if (attached && gpuDebug != nullptr) { + if (GPUDebug::IsActive() && gpuDebug != nullptr) { UpdatePreviews(); } break; @@ -785,14 +784,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { break; case IDC_GEDBG_FORCEOPAQUE: - if (attached && gpuDebug != nullptr) { + if (GPUDebug::IsActive() && gpuDebug != nullptr) { forceOpaque_ = SendMessage(GetDlgItem(m_hDlg, IDC_GEDBG_FORCEOPAQUE), BM_GETCHECK, 0, 0) != 0; UpdatePreviews(); } break; case IDC_GEDBG_SHOWCLUT: - if (attached && gpuDebug != nullptr) { + if (GPUDebug::IsActive() && gpuDebug != nullptr) { showClut_ = SendMessage(GetDlgItem(m_hDlg, IDC_GEDBG_SHOWCLUT), BM_GETCHECK, 0, 0) != 0; UpdatePreviews(); } @@ -823,7 +822,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { case WM_GEDBG_TOGGLEPCBREAKPOINT: { - attached = true; + GPUDebug::SetActive(true); u32 pc = (u32)wParam; bool temp; bool isBreak = IsAddressBreakpoint(pc, temp); @@ -837,7 +836,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { case WM_GEDBG_RUNTOWPARAM: { - attached = true; + GPUDebug::SetActive(true); u32 pc = (u32)wParam; AddAddressBreakpoint(pc, true); SendMessage(m_hDlg,WM_COMMAND,IDC_GEDBG_RESUME,0); @@ -862,16 +861,12 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) { // The below WindowsHost methods are called on the GPU thread. -bool WindowsHost::GPUDebuggingActive() { - return attached; -} - static void DeliverMessage(UINT msg, WPARAM wParam, LPARAM lParam) { PostMessage(geDebuggerWindow->GetDlgHandle(), msg, wParam, lParam); } static void PauseWithMessage(UINT msg, WPARAM wParam = NULL, LPARAM lParam = NULL) { - if (attached) { + if (GPUDebug::IsActive()) { EnterStepping(std::bind(&DeliverMessage, msg, wParam, lParam)); } } @@ -897,6 +892,3 @@ void WindowsHost::GPUNotifyDraw() { PauseWithMessage(WM_GEDBG_BREAK_DRAW); } } - -void WindowsHost::GPUNotifyTextureAttachment(u32 addr) { -} diff --git a/Windows/WindowsHost.h b/Windows/WindowsHost.h index f05aeca316..904ead1c49 100644 --- a/Windows/WindowsHost.h +++ b/Windows/WindowsHost.h @@ -55,11 +55,9 @@ public: void SaveSymbolMap() override; void SetWindowTitle(const char *message) override; - bool GPUDebuggingActive() override; void GPUNotifyCommand(u32 pc) override; void GPUNotifyDisplay(u32 framebuf, u32 stride, int format) override; void GPUNotifyDraw() override; - void GPUNotifyTextureAttachment(u32 addr) override; void ToggleDebugConsoleVisibility() override; bool CanCreateShortcut() override; diff --git a/android/jni/Android.mk b/android/jni/Android.mk index 171ca31310..b399653d63 100644 --- a/android/jni/Android.mk +++ b/android/jni/Android.mk @@ -242,6 +242,7 @@ EXEC_AND_LIB_FILES := \ $(SRC)/GPU/Common/PostShader.cpp \ $(SRC)/GPU/Common/ShaderUniforms.cpp \ $(SRC)/GPU/Debugger/Breakpoints.cpp \ + $(SRC)/GPU/Debugger/Debugger.cpp \ $(SRC)/GPU/Debugger/Record.cpp \ $(SRC)/GPU/Debugger/Stepping.cpp \ $(SRC)/GPU/GLES/FramebufferManagerGLES.cpp \ diff --git a/libretro/Makefile.common b/libretro/Makefile.common index fd6e262e35..13475121f5 100644 --- a/libretro/Makefile.common +++ b/libretro/Makefile.common @@ -168,8 +168,9 @@ SOURCES_CXX += \ $(GPUCOMMONDIR)/PostShader.cpp \ $(COMMONDIR)/ColorConv.cpp \ $(GPUDIR)/Debugger/Breakpoints.cpp \ - $(GPUDIR)/Debugger/Stepping.cpp \ + $(GPUDIR)/Debugger/Debugger.cpp \ $(GPUDIR)/Debugger/Record.cpp \ + $(GPUDIR)/Debugger/Stepping.cpp \ $(GPUDIR)/Common/TextureCacheCommon.cpp \ $(GPUDIR)/Common/TextureScalerCommon.cpp \ $(GPUDIR)/Common/SoftwareTransformCommon.cpp \