GE Debugger: Factor out host calls some.

Moving more of this to cross platform for the web debugger.
This commit is contained in:
Unknown W. Brackets 2018-09-01 08:32:03 -07:00
parent d91637390d
commit a4c0640f01
24 changed files with 149 additions and 64 deletions

View File

@ -1357,6 +1357,8 @@ set(GPU_SOURCES
GPU/Common/SplineCommon.h GPU/Common/SplineCommon.h
GPU/Debugger/Breakpoints.cpp GPU/Debugger/Breakpoints.cpp
GPU/Debugger/Breakpoints.h GPU/Debugger/Breakpoints.h
GPU/Debugger/Debugger.cpp
GPU/Debugger/Debugger.h
GPU/Debugger/Record.cpp GPU/Debugger/Record.cpp
GPU/Debugger/Record.h GPU/Debugger/Record.h
GPU/Debugger/Stepping.cpp GPU/Debugger/Stepping.cpp

View File

@ -51,11 +51,9 @@ public:
virtual void SetWindowTitle(const char *message) {} virtual void SetWindowTitle(const char *message) {}
// While debugging is active, it's perfectly fine for these to block. // While debugging is active, it's perfectly fine for these to block.
virtual bool GPUDebuggingActive() { return false; }
virtual void GPUNotifyCommand(u32 pc) {} virtual void GPUNotifyCommand(u32 pc) {}
virtual void GPUNotifyDisplay(u32 framebuf, u32 stride, int format) {} virtual void GPUNotifyDisplay(u32 framebuf, u32 stride, int format) {}
virtual void GPUNotifyDraw() {} virtual void GPUNotifyDraw() {}
virtual void GPUNotifyTextureAttachment(u32 addr) {}
virtual bool CanCreateShortcut() {return false;} virtual bool CanCreateShortcut() {return false;}
virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title) {return false;} virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title) {return false;}

View File

@ -20,7 +20,6 @@
#include "Common/ColorConv.h" #include "Common/ColorConv.h"
#include "Common/MemoryUtil.h" #include "Common/MemoryUtil.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/Host.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
#include "Core/System.h" #include "Core/System.h"
#include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/FramebufferCommon.h"
@ -28,6 +27,7 @@
#include "GPU/Common/TextureDecoder.h" #include "GPU/Common/TextureDecoder.h"
#include "GPU/Common/ShaderId.h" #include "GPU/Common/ShaderId.h"
#include "GPU/Common/GPUStateUtils.h" #include "GPU/Common/GPUStateUtils.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/GPUState.h" #include "GPU/GPUState.h"
#include "GPU/GPUInterface.h" #include "GPU/GPUInterface.h"
@ -708,7 +708,7 @@ void TextureCacheCommon::AttachFramebufferValid(TexCacheEntry *entry, VirtualFra
entry->maxLevel = 0; entry->maxLevel = 0;
fbTexInfo_[cachekey] = fbInfo; fbTexInfo_[cachekey] = fbInfo;
framebuffer->last_frame_attached = gpuStats.numFlips; framebuffer->last_frame_attached = gpuStats.numFlips;
host->GPUNotifyTextureAttachment(entry->addr); GPUDebug::NotifyTextureAttachment(entry->addr);
} else if (entry->framebuffer == framebuffer) { } else if (entry->framebuffer == framebuffer) {
framebuffer->last_frame_attached = gpuStats.numFlips; framebuffer->last_frame_attached = gpuStats.numFlips;
} }
@ -727,7 +727,7 @@ void TextureCacheCommon::AttachFramebufferInvalid(TexCacheEntry *entry, VirtualF
entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE; entry->status &= ~TexCacheEntry::STATUS_DEPALETTIZE;
entry->maxLevel = 0; entry->maxLevel = 0;
fbTexInfo_[cachekey] = fbInfo; 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. // Otherwise we never recreate the texture.
entry->hash ^= 1; entry->hash ^= 1;
fbTexInfo_.erase(cachekey); fbTexInfo_.erase(cachekey);
host->GPUNotifyTextureAttachment(entry->addr); GPUDebug::NotifyTextureAttachment(entry->addr);
} }
} }

View File

@ -22,7 +22,6 @@
#include "Common/MemoryUtil.h" #include "Common/MemoryUtil.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/Host.h"
#include "Core/System.h" #include "Core/System.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
#include "Core/Config.h" #include "Core/Config.h"
@ -34,10 +33,10 @@
#include "GPU/Common/TextureDecoder.h" #include "GPU/Common/TextureDecoder.h"
#include "GPU/Common/SplineCommon.h" #include "GPU/Common/SplineCommon.h"
#include "GPU/Common/TransformCommon.h" #include "GPU/Common/TransformCommon.h"
#include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/SoftwareTransformCommon.h" #include "GPU/Common/SoftwareTransformCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/D3D11/FramebufferManagerD3D11.h" #include "GPU/D3D11/FramebufferManagerD3D11.h"
#include "GPU/D3D11/TextureCacheD3D11.h" #include "GPU/D3D11/TextureCacheD3D11.h"
#include "GPU/D3D11/DrawEngineD3D11.h" #include "GPU/D3D11/DrawEngineD3D11.h"
@ -690,10 +689,7 @@ rotateVBO:
gstate_c.vertBounds.maxU = 0; gstate_c.vertBounds.maxU = 0;
gstate_c.vertBounds.maxV = 0; gstate_c.vertBounds.maxV = 0;
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP) GPUDebug::NotifyDraw();
// We only support GPU debugging on Windows, and that's the only use case for this.
host->GPUNotifyDraw();
#endif
} }
void DrawEngineD3D11::TessellationDataTransferD3D11::PrepareBuffers(float *&pos, float *&tex, float *&col, int &posStride, int &texStride, int &colStride, int size, bool hasColor, bool hasTexCoords) { void DrawEngineD3D11::TessellationDataTransferD3D11::PrepareBuffers(float *&pos, float *&tex, float *&col, int &posStride, int &texStride, int &colStride, int size, bool hasColor, bool hasTexCoords) {

View File

@ -45,7 +45,6 @@
#include "Core/Debugger/Breakpoints.h" #include "Core/Debugger/Breakpoints.h"
#include "Core/MemMapHelpers.h" #include "Core/MemMapHelpers.h"
#include "Core/MIPS/MIPS.h" #include "Core/MIPS/MIPS.h"
#include "Core/Host.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
#include "Core/System.h" #include "Core/System.h"
@ -55,6 +54,7 @@
#include "GPU/GeDisasm.h" #include "GPU/GeDisasm.h"
#include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/FramebufferCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/D3D11/ShaderManagerD3D11.h" #include "GPU/D3D11/ShaderManagerD3D11.h"
#include "GPU/D3D11/GPU_D3D11.h" #include "GPU/D3D11/GPU_D3D11.h"
#include "GPU/D3D11/FramebufferManagerD3D11.h" #include "GPU/D3D11/FramebufferManagerD3D11.h"
@ -254,7 +254,7 @@ void GPU_D3D11::BeginFrame() {
void GPU_D3D11::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) { void GPU_D3D11::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {
// TODO: Some games like Spongebob - Yellow Avenger, never change framebuffer, they blit to it. // 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. // 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); framebufferManagerD3D11_->SetDisplayFramebuffer(framebuf, stride, format);
} }

48
GPU/Debugger/Debugger.cpp Normal file
View File

@ -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) {
}
}

33
GPU/Debugger/Debugger.h Normal file
View File

@ -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);
}

View File

@ -20,7 +20,6 @@
#include "Common/MemoryUtil.h" #include "Common/MemoryUtil.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/Host.h"
#include "Core/System.h" #include "Core/System.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
#include "Core/Config.h" #include "Core/Config.h"
@ -36,6 +35,7 @@
#include "GPU/Common/TransformCommon.h" #include "GPU/Common/TransformCommon.h"
#include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/SoftwareTransformCommon.h" #include "GPU/Common/SoftwareTransformCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/Directx9/TextureCacheDX9.h" #include "GPU/Directx9/TextureCacheDX9.h"
#include "GPU/Directx9/DrawEngineDX9.h" #include "GPU/Directx9/DrawEngineDX9.h"
#include "GPU/Directx9/ShaderManagerDX9.h" #include "GPU/Directx9/ShaderManagerDX9.h"
@ -621,7 +621,7 @@ rotateVBO:
gstate_c.vertBounds.maxU = 0; gstate_c.vertBounds.maxU = 0;
gstate_c.vertBounds.maxV = 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) void DrawEngineDX9::TessellationDataTransferDX9::SendDataToShader(const float * pos, const float * tex, const float * col, int size, bool hasColor, bool hasTexCoords)

View File

@ -39,6 +39,7 @@
#include "GPU/GeDisasm.h" #include "GPU/GeDisasm.h"
#include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/FramebufferCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/Directx9/ShaderManagerDX9.h" #include "GPU/Directx9/ShaderManagerDX9.h"
#include "GPU/Directx9/GPU_DX9.h" #include "GPU/Directx9/GPU_DX9.h"
#include "GPU/Directx9/FramebufferDX9.h" #include "GPU/Directx9/FramebufferDX9.h"
@ -230,7 +231,7 @@ void GPU_DX9::BeginFrame() {
} }
void GPU_DX9::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) { 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); framebufferManagerDX9_->SetDisplayFramebuffer(framebuf, stride, format);
} }

View File

@ -20,7 +20,6 @@
#include "Common/MemoryUtil.h" #include "Common/MemoryUtil.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/Host.h"
#include "Core/System.h" #include "Core/System.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
#include "Core/Config.h" #include "Core/Config.h"
@ -37,6 +36,7 @@
#include "GPU/Common/SplineCommon.h" #include "GPU/Common/SplineCommon.h"
#include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/SoftwareTransformCommon.h" #include "GPU/Common/SoftwareTransformCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/GLES/FragmentTestCacheGLES.h" #include "GPU/GLES/FragmentTestCacheGLES.h"
#include "GPU/GLES/StateMappingGLES.h" #include "GPU/GLES/StateMappingGLES.h"
#include "GPU/GLES/TextureCacheGLES.h" #include "GPU/GLES/TextureCacheGLES.h"
@ -648,9 +648,7 @@ rotateVBO:
gstate_c.vertBounds.maxU = 0; gstate_c.vertBounds.maxU = 0;
gstate_c.vertBounds.maxV = 0; gstate_c.vertBounds.maxV = 0;
#ifndef MOBILE_DEVICE GPUDebug::NotifyDraw();
host->GPUNotifyDraw();
#endif
} }
bool DrawEngineGLES::IsCodePtrVertexDecoder(const u8 *ptr) const { bool DrawEngineGLES::IsCodePtrVertexDecoder(const u8 *ptr) const {

View File

@ -35,7 +35,7 @@
#include "GPU/ge_constants.h" #include "GPU/ge_constants.h"
#include "GPU/GeDisasm.h" #include "GPU/GeDisasm.h"
#include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/FramebufferCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/GLES/ShaderManagerGLES.h" #include "GPU/GLES/ShaderManagerGLES.h"
#include "GPU/GLES/GPU_GLES.h" #include "GPU/GLES/GPU_GLES.h"
#include "GPU/GLES/FramebufferManagerGLES.h" #include "GPU/GLES/FramebufferManagerGLES.h"
@ -443,7 +443,7 @@ void GPU_GLES::BeginFrame() {
} }
void GPU_GLES::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) { 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); framebufferManagerGL_->SetDisplayFramebuffer(framebuf, stride, format);
} }

View File

@ -217,6 +217,7 @@
<ClInclude Include="D3D11\TextureScalerD3D11.h" /> <ClInclude Include="D3D11\TextureScalerD3D11.h" />
<ClInclude Include="D3D11\VertexShaderGeneratorD3D11.h" /> <ClInclude Include="D3D11\VertexShaderGeneratorD3D11.h" />
<ClInclude Include="Debugger\Breakpoints.h" /> <ClInclude Include="Debugger\Breakpoints.h" />
<ClInclude Include="Debugger\Debugger.h" />
<ClInclude Include="Debugger\Record.h" /> <ClInclude Include="Debugger\Record.h" />
<ClInclude Include="Debugger\Stepping.h" /> <ClInclude Include="Debugger\Stepping.h" />
<ClInclude Include="Directx9\DepalettizeShaderDX9.h" /> <ClInclude Include="Directx9\DepalettizeShaderDX9.h" />
@ -320,6 +321,7 @@
<ClCompile Include="D3D11\TextureScalerD3D11.cpp" /> <ClCompile Include="D3D11\TextureScalerD3D11.cpp" />
<ClCompile Include="D3D11\VertexShaderGeneratorD3D11.cpp" /> <ClCompile Include="D3D11\VertexShaderGeneratorD3D11.cpp" />
<ClCompile Include="Debugger\Breakpoints.cpp" /> <ClCompile Include="Debugger\Breakpoints.cpp" />
<ClCompile Include="Debugger\Debugger.cpp" />
<ClCompile Include="Debugger\Record.cpp" /> <ClCompile Include="Debugger\Record.cpp" />
<ClCompile Include="Debugger\Stepping.cpp" /> <ClCompile Include="Debugger\Stepping.cpp" />
<ClCompile Include="Directx9\DepalettizeShaderDX9.cpp" /> <ClCompile Include="Directx9\DepalettizeShaderDX9.cpp" />

View File

@ -273,6 +273,9 @@
<ClInclude Include="Vulkan\DebugVisVulkan.h"> <ClInclude Include="Vulkan\DebugVisVulkan.h">
<Filter>Vulkan</Filter> <Filter>Vulkan</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Debugger\Debugger.h">
<Filter>Debugger</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="Math3D.cpp"> <ClCompile Include="Math3D.cpp">
@ -542,5 +545,8 @@
<ClCompile Include="Vulkan\DebugVisVulkan.cpp"> <ClCompile Include="Vulkan\DebugVisVulkan.cpp">
<Filter>Vulkan</Filter> <Filter>Vulkan</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="Debugger\Debugger.cpp">
<Filter>Debugger</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -28,6 +28,7 @@
#include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/FramebufferCommon.h"
#include "GPU/Common/SplineCommon.h" #include "GPU/Common/SplineCommon.h"
#include "GPU/Common/TextureCacheCommon.h" #include "GPU/Common/TextureCacheCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/Debugger/Record.h" #include "GPU/Debugger/Record.h"
const CommonCommandTableEntry commonCommandTable[] = { const CommonCommandTableEntry commonCommandTable[] = {
@ -933,7 +934,7 @@ bool GPUCommon::InterpretList(DisplayList &list) {
gpuState = list.pc == list.stall ? GPUSTATE_STALL : GPUSTATE_RUNNING; gpuState = list.pc == list.stall ? GPUSTATE_STALL : GPUSTATE_RUNNING;
debugRecording_ = GPURecord::IsActive(); debugRecording_ = GPURecord::IsActive();
const bool useDebugger = host->GPUDebuggingActive() || debugRecording_; const bool useDebugger = GPUDebug::IsActive() || debugRecording_;
const bool useFastRunLoop = !dumpThisFrame_ && !useDebugger; const bool useFastRunLoop = !dumpThisFrame_ && !useDebugger;
while (gpuState == GPUSTATE_RUNNING) { while (gpuState == GPUSTATE_RUNNING) {
{ {
@ -1035,7 +1036,7 @@ void GPUCommon::SlowRunLoop(DisplayList &list)
const bool dumpThisFrame = dumpThisFrame_; const bool dumpThisFrame = dumpThisFrame_;
while (downcount > 0) while (downcount > 0)
{ {
host->GPUNotifyCommand(list.pc); GPUDebug::NotifyCommand(list.pc);
GPURecord::NotifyCommand(list.pc); GPURecord::NotifyCommand(list.pc);
u32 op = Memory::ReadUnchecked_U32(list.pc); u32 op = Memory::ReadUnchecked_U32(list.pc);
u32 cmd = op >> 24; u32 cmd = op >> 24;
@ -1586,10 +1587,8 @@ void GPUCommon::Execute_Prim(u32 op, u32 diff) {
if (!g_Config.bSoftwareSkinning) if (!g_Config.bSoftwareSkinning)
vtypeCheckMask = 0xFFFFFFFF; vtypeCheckMask = 0xFFFFFFFF;
#ifndef MOBILE_DEVICE if (debugRecording_ || GPUDebug::IsActive())
if (debugRecording_ || host->GPUDebuggingActive())
goto bail; goto bail;
#endif
while (src != stall) { while (src != stall) {
uint32_t data = *src; uint32_t data = *src;

View File

@ -23,7 +23,6 @@
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/ConfigValues.h" #include "Core/ConfigValues.h"
#include "Core/Debugger/Breakpoints.h" #include "Core/Debugger/Breakpoints.h"
#include "Core/Host.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/HLE/sceKernelInterrupt.h" #include "Core/HLE/sceKernelInterrupt.h"
#include "Core/HLE/sceGe.h" #include "Core/HLE/sceGe.h"
@ -39,6 +38,7 @@
#include "GPU/Software/TransformUnit.h" #include "GPU/Software/TransformUnit.h"
#include "GPU/Common/DrawEngineCommon.h" #include "GPU/Common/DrawEngineCommon.h"
#include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/FramebufferCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/Debugger/Record.h" #include "GPU/Debugger/Record.h"
const int FB_WIDTH = 480; 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; displayFramebuf_ = (framebuf & 0xFF000000) == 0 ? 0x44000000 | framebuf : framebuf;
displayStride_ = stride; displayStride_ = stride;
displayFormat_ = format; displayFormat_ = format;
host->GPUNotifyDisplay(framebuf, stride, format); GPUDebug::NotifyDisplay(framebuf, stride, format);
} }
// Copies RGBA8 data from RAM to the currently bound render target. // Copies RGBA8 data from RAM to the currently bound render target.

View File

@ -16,13 +16,12 @@
// https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/.
#include "Common/MemoryUtil.h" #include "Common/MemoryUtil.h"
#include "Core/Host.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "GPU/GPUState.h" #include "GPU/GPUState.h"
#include "GPU/Common/DrawEngineCommon.h" #include "GPU/Common/DrawEngineCommon.h"
#include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/SplineCommon.h" #include "GPU/Common/SplineCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/Software/TransformUnit.h" #include "GPU/Software/TransformUnit.h"
#include "GPU/Software/Clipper.h" #include "GPU/Software/Clipper.h"
#include "GPU/Software/Lighting.h" #include "GPU/Software/Lighting.h"
@ -490,7 +489,7 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, GEPrimitiveTy
break; break;
} }
host->GPUNotifyDraw(); GPUDebug::NotifyDraw();
} }
// TODO: This probably is not the best interface. // TODO: This probably is not the best interface.

View File

@ -25,7 +25,6 @@
#include "Common/MemoryUtil.h" #include "Common/MemoryUtil.h"
#include "Core/MemMap.h" #include "Core/MemMap.h"
#include "Core/Host.h"
#include "Core/System.h" #include "Core/System.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
#include "Core/Config.h" #include "Core/Config.h"
@ -44,6 +43,7 @@
#include "GPU/Common/VertexDecoderCommon.h" #include "GPU/Common/VertexDecoderCommon.h"
#include "GPU/Common/SoftwareTransformCommon.h" #include "GPU/Common/SoftwareTransformCommon.h"
#include "GPU/Common/DrawEngineCommon.h" #include "GPU/Common/DrawEngineCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/Vulkan/DrawEngineVulkan.h" #include "GPU/Vulkan/DrawEngineVulkan.h"
#include "GPU/Vulkan/TextureCacheVulkan.h" #include "GPU/Vulkan/TextureCacheVulkan.h"
#include "GPU/Vulkan/ShaderManagerVulkan.h" #include "GPU/Vulkan/ShaderManagerVulkan.h"
@ -976,7 +976,7 @@ void DrawEngineVulkan::DoFlush() {
gstate_c.vertBounds.maxU = 0; gstate_c.vertBounds.maxU = 0;
gstate_c.vertBounds.maxV = 0; gstate_c.vertBounds.maxV = 0;
host->GPUNotifyDraw(); GPUDebug::NotifyDraw();
} }
void DrawEngineVulkan::UpdateUBOs(FrameData *frame) { void DrawEngineVulkan::UpdateUBOs(FrameData *frame) {

View File

@ -26,7 +26,6 @@
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/Debugger/Breakpoints.h" #include "Core/Debugger/Breakpoints.h"
#include "Core/MemMapHelpers.h" #include "Core/MemMapHelpers.h"
#include "Core/Host.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "Core/Reporting.h" #include "Core/Reporting.h"
#include "Core/System.h" #include "Core/System.h"
@ -36,7 +35,7 @@
#include "GPU/ge_constants.h" #include "GPU/ge_constants.h"
#include "GPU/GeDisasm.h" #include "GPU/GeDisasm.h"
#include "GPU/Common/FramebufferCommon.h" #include "GPU/Common/FramebufferCommon.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/Vulkan/ShaderManagerVulkan.h" #include "GPU/Vulkan/ShaderManagerVulkan.h"
#include "GPU/Vulkan/GPU_Vulkan.h" #include "GPU/Vulkan/GPU_Vulkan.h"
#include "GPU/Vulkan/FramebufferVulkan.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) { 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); framebufferManager_->SetDisplayFramebuffer(framebuf, stride, format);
} }

View File

@ -332,6 +332,7 @@
<ClInclude Include="..\..\GPU\D3D11\TextureScalerD3D11.h" /> <ClInclude Include="..\..\GPU\D3D11\TextureScalerD3D11.h" />
<ClInclude Include="..\..\GPU\D3D11\VertexShaderGeneratorD3D11.h" /> <ClInclude Include="..\..\GPU\D3D11\VertexShaderGeneratorD3D11.h" />
<ClInclude Include="..\..\GPU\Debugger\Breakpoints.h" /> <ClInclude Include="..\..\GPU\Debugger\Breakpoints.h" />
<ClInclude Include="..\..\GPU\Debugger\Debugger.h" />
<ClInclude Include="..\..\GPU\Debugger\Record.h" /> <ClInclude Include="..\..\GPU\Debugger\Record.h" />
<ClInclude Include="..\..\GPU\Debugger\Stepping.h" /> <ClInclude Include="..\..\GPU\Debugger\Stepping.h" />
<ClInclude Include="..\..\GPU\Directx9\PixelShaderGeneratorDX9.h" /> <ClInclude Include="..\..\GPU\Directx9\PixelShaderGeneratorDX9.h" />
@ -390,6 +391,7 @@
<ClCompile Include="..\..\GPU\D3D11\TextureScalerD3D11.cpp" /> <ClCompile Include="..\..\GPU\D3D11\TextureScalerD3D11.cpp" />
<ClCompile Include="..\..\GPU\D3D11\VertexShaderGeneratorD3D11.cpp" /> <ClCompile Include="..\..\GPU\D3D11\VertexShaderGeneratorD3D11.cpp" />
<ClCompile Include="..\..\GPU\Debugger\Breakpoints.cpp" /> <ClCompile Include="..\..\GPU\Debugger\Breakpoints.cpp" />
<ClCompile Include="..\..\GPU\Debugger\Debugger.cpp" />
<ClCompile Include="..\..\GPU\Debugger\Record.cpp" /> <ClCompile Include="..\..\GPU\Debugger\Record.cpp" />
<ClCompile Include="..\..\GPU\Debugger\Stepping.cpp" /> <ClCompile Include="..\..\GPU\Debugger\Stepping.cpp" />
<ClCompile Include="..\..\GPU\Directx9\PixelShaderGeneratorDX9.cpp" /> <ClCompile Include="..\..\GPU\Directx9\PixelShaderGeneratorDX9.cpp" />

View File

@ -150,13 +150,18 @@
<ClCompile Include="..\..\GPU\Debugger\Breakpoints.cpp"> <ClCompile Include="..\..\GPU\Debugger\Breakpoints.cpp">
<Filter>Debugger</Filter> <Filter>Debugger</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\GPU\Debugger\Debugger.cpp">
<Filter>Debugger</Filter>
</ClCompile>
<ClCompile Include="..\..\GPU\Debugger\Stepping.cpp"> <ClCompile Include="..\..\GPU\Debugger\Stepping.cpp">
<Filter>Debugger</Filter> <Filter>Debugger</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\GPU\Common\ShaderCommon.cpp"> <ClCompile Include="..\..\GPU\Common\ShaderCommon.cpp">
<Filter>Common</Filter> <Filter>Common</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\GPU\Software\Sampler.cpp" /> <ClCompile Include="..\..\GPU\Software\Sampler.cpp">
<Filter>Software</Filter>
</ClInclude>
<ClCompile Include="..\..\GPU\Debugger\Record.cpp"> <ClCompile Include="..\..\GPU\Debugger\Record.cpp">
<Filter>Debugger</Filter> <Filter>Debugger</Filter>
</ClCompile> </ClCompile>
@ -291,10 +296,15 @@
<ClInclude Include="..\..\GPU\Debugger\Breakpoints.h"> <ClInclude Include="..\..\GPU\Debugger\Breakpoints.h">
<Filter>Debugger</Filter> <Filter>Debugger</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\GPU\Debugger\Debugger.h">
<Filter>Debugger</Filter>
</ClInclude>
<ClInclude Include="..\..\GPU\Debugger\Stepping.h"> <ClInclude Include="..\..\GPU\Debugger\Stepping.h">
<Filter>Debugger</Filter> <Filter>Debugger</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\GPU\Software\Sampler.h" /> <ClInclude Include="..\..\GPU\Software\Sampler.h">
<Filter>Software</Filter>
</ClInclude>
<ClInclude Include="..\..\GPU\Debugger\Record.h"> <ClInclude Include="..\..\GPU\Debugger\Record.h">
<Filter>Debugger</Filter> <Filter>Debugger</Filter>
</ClInclude> </ClInclude>

View File

@ -39,6 +39,7 @@
#include "GPU/Common/GPUStateUtils.h" #include "GPU/Common/GPUStateUtils.h"
#include "GPU/GPUState.h" #include "GPU/GPUState.h"
#include "GPU/Debugger/Breakpoints.h" #include "GPU/Debugger/Breakpoints.h"
#include "GPU/Debugger/Debugger.h"
#include "GPU/Debugger/Record.h" #include "GPU/Debugger/Record.h"
#include "GPU/Debugger/Stepping.h" #include "GPU/Debugger/Stepping.h"
#include <windowsx.h> #include <windowsx.h>
@ -49,8 +50,6 @@ const int POPUP_SUBMENU_ID_GEDBG_PREVIEW = 10;
using namespace GPUBreakpoints; using namespace GPUBreakpoints;
using namespace GPUStepping; using namespace GPUStepping;
static bool attached = false;
static BreakNextType breakNext = BREAK_NONE; static BreakNextType breakNext = BREAK_NONE;
enum PrimaryDisplayType { enum PrimaryDisplayType {
@ -627,7 +626,7 @@ void CGEDebugger::SavePosition()
} }
void CGEDebugger::SetBreakNext(BreakNextType type) { void CGEDebugger::SetBreakNext(BreakNextType type) {
attached = true; GPUDebug::SetActive(true);
SetupPreviews(); SetupPreviews();
breakNext = type; breakNext = type;
@ -657,7 +656,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
return TRUE; return TRUE;
case WM_CLOSE: case WM_CLOSE:
attached = false; GPUDebug::SetActive(false);
ResumeFromStepping(); ResumeFromStepping();
breakNext = BREAK_NONE; breakNext = BREAK_NONE;
@ -685,7 +684,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
break; break;
case IDC_GEDBG_FBTABS: case IDC_GEDBG_FBTABS:
fbTabs->HandleNotify(lParam); fbTabs->HandleNotify(lParam);
if (attached && gpuDebug != nullptr) { if (GPUDebug::IsActive() && gpuDebug != nullptr) {
UpdatePreviews(); UpdatePreviews();
} }
break; break;
@ -720,7 +719,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case IDC_GEDBG_BREAKTEX: case IDC_GEDBG_BREAKTEX:
{ {
attached = true; GPUDebug::SetActive(true);
if (!gpuDebug) { if (!gpuDebug) {
break; break;
} }
@ -739,7 +738,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case IDC_GEDBG_BREAKTARGET: case IDC_GEDBG_BREAKTARGET:
{ {
attached = true; GPUDebug::SetActive(true);
if (!gpuDebug) { if (!gpuDebug) {
break; break;
} }
@ -758,14 +757,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case IDC_GEDBG_TEXLEVELDOWN: case IDC_GEDBG_TEXLEVELDOWN:
UpdateTextureLevel(textureLevel_ - 1); UpdateTextureLevel(textureLevel_ - 1);
if (attached && gpuDebug != nullptr) { if (GPUDebug::IsActive() && gpuDebug != nullptr) {
UpdatePreviews(); UpdatePreviews();
} }
break; break;
case IDC_GEDBG_TEXLEVELUP: case IDC_GEDBG_TEXLEVELUP:
UpdateTextureLevel(textureLevel_ + 1); UpdateTextureLevel(textureLevel_ + 1);
if (attached && gpuDebug != nullptr) { if (GPUDebug::IsActive() && gpuDebug != nullptr) {
UpdatePreviews(); UpdatePreviews();
} }
break; break;
@ -785,14 +784,14 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
break; break;
case IDC_GEDBG_FORCEOPAQUE: 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; forceOpaque_ = SendMessage(GetDlgItem(m_hDlg, IDC_GEDBG_FORCEOPAQUE), BM_GETCHECK, 0, 0) != 0;
UpdatePreviews(); UpdatePreviews();
} }
break; break;
case IDC_GEDBG_SHOWCLUT: 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; showClut_ = SendMessage(GetDlgItem(m_hDlg, IDC_GEDBG_SHOWCLUT), BM_GETCHECK, 0, 0) != 0;
UpdatePreviews(); UpdatePreviews();
} }
@ -823,7 +822,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case WM_GEDBG_TOGGLEPCBREAKPOINT: case WM_GEDBG_TOGGLEPCBREAKPOINT:
{ {
attached = true; GPUDebug::SetActive(true);
u32 pc = (u32)wParam; u32 pc = (u32)wParam;
bool temp; bool temp;
bool isBreak = IsAddressBreakpoint(pc, temp); bool isBreak = IsAddressBreakpoint(pc, temp);
@ -837,7 +836,7 @@ BOOL CGEDebugger::DlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
case WM_GEDBG_RUNTOWPARAM: case WM_GEDBG_RUNTOWPARAM:
{ {
attached = true; GPUDebug::SetActive(true);
u32 pc = (u32)wParam; u32 pc = (u32)wParam;
AddAddressBreakpoint(pc, true); AddAddressBreakpoint(pc, true);
SendMessage(m_hDlg,WM_COMMAND,IDC_GEDBG_RESUME,0); 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. // The below WindowsHost methods are called on the GPU thread.
bool WindowsHost::GPUDebuggingActive() {
return attached;
}
static void DeliverMessage(UINT msg, WPARAM wParam, LPARAM lParam) { static void DeliverMessage(UINT msg, WPARAM wParam, LPARAM lParam) {
PostMessage(geDebuggerWindow->GetDlgHandle(), msg, wParam, lParam); PostMessage(geDebuggerWindow->GetDlgHandle(), msg, wParam, lParam);
} }
static void PauseWithMessage(UINT msg, WPARAM wParam = NULL, LPARAM lParam = NULL) { static void PauseWithMessage(UINT msg, WPARAM wParam = NULL, LPARAM lParam = NULL) {
if (attached) { if (GPUDebug::IsActive()) {
EnterStepping(std::bind(&DeliverMessage, msg, wParam, lParam)); EnterStepping(std::bind(&DeliverMessage, msg, wParam, lParam));
} }
} }
@ -897,6 +892,3 @@ void WindowsHost::GPUNotifyDraw() {
PauseWithMessage(WM_GEDBG_BREAK_DRAW); PauseWithMessage(WM_GEDBG_BREAK_DRAW);
} }
} }
void WindowsHost::GPUNotifyTextureAttachment(u32 addr) {
}

View File

@ -55,11 +55,9 @@ public:
void SaveSymbolMap() override; void SaveSymbolMap() override;
void SetWindowTitle(const char *message) override; void SetWindowTitle(const char *message) override;
bool GPUDebuggingActive() override;
void GPUNotifyCommand(u32 pc) override; void GPUNotifyCommand(u32 pc) override;
void GPUNotifyDisplay(u32 framebuf, u32 stride, int format) override; void GPUNotifyDisplay(u32 framebuf, u32 stride, int format) override;
void GPUNotifyDraw() override; void GPUNotifyDraw() override;
void GPUNotifyTextureAttachment(u32 addr) override;
void ToggleDebugConsoleVisibility() override; void ToggleDebugConsoleVisibility() override;
bool CanCreateShortcut() override; bool CanCreateShortcut() override;

View File

@ -242,6 +242,7 @@ EXEC_AND_LIB_FILES := \
$(SRC)/GPU/Common/PostShader.cpp \ $(SRC)/GPU/Common/PostShader.cpp \
$(SRC)/GPU/Common/ShaderUniforms.cpp \ $(SRC)/GPU/Common/ShaderUniforms.cpp \
$(SRC)/GPU/Debugger/Breakpoints.cpp \ $(SRC)/GPU/Debugger/Breakpoints.cpp \
$(SRC)/GPU/Debugger/Debugger.cpp \
$(SRC)/GPU/Debugger/Record.cpp \ $(SRC)/GPU/Debugger/Record.cpp \
$(SRC)/GPU/Debugger/Stepping.cpp \ $(SRC)/GPU/Debugger/Stepping.cpp \
$(SRC)/GPU/GLES/FramebufferManagerGLES.cpp \ $(SRC)/GPU/GLES/FramebufferManagerGLES.cpp \

View File

@ -168,8 +168,9 @@ SOURCES_CXX += \
$(GPUCOMMONDIR)/PostShader.cpp \ $(GPUCOMMONDIR)/PostShader.cpp \
$(COMMONDIR)/ColorConv.cpp \ $(COMMONDIR)/ColorConv.cpp \
$(GPUDIR)/Debugger/Breakpoints.cpp \ $(GPUDIR)/Debugger/Breakpoints.cpp \
$(GPUDIR)/Debugger/Stepping.cpp \ $(GPUDIR)/Debugger/Debugger.cpp \
$(GPUDIR)/Debugger/Record.cpp \ $(GPUDIR)/Debugger/Record.cpp \
$(GPUDIR)/Debugger/Stepping.cpp \
$(GPUDIR)/Common/TextureCacheCommon.cpp \ $(GPUDIR)/Common/TextureCacheCommon.cpp \
$(GPUDIR)/Common/TextureScalerCommon.cpp \ $(GPUDIR)/Common/TextureScalerCommon.cpp \
$(GPUDIR)/Common/SoftwareTransformCommon.cpp \ $(GPUDIR)/Common/SoftwareTransformCommon.cpp \