mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-01-31 10:32:30 +00:00
Add GPU debugging hooks to Host, not yet in use.
This commit is contained in:
parent
1dccc952d9
commit
eabd8b5302
@ -998,6 +998,7 @@ set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp
|
||||
add_dependencies(${CoreLibName} GitVersion)
|
||||
|
||||
add_library(GPU OBJECT
|
||||
GPU/Common/GPUDebugInterface.h
|
||||
GPU/Common/VertexDecoderCommon.cpp
|
||||
GPU/Common/VertexDecoderCommon.h
|
||||
GPU/Common/IndexGenerator.cpp
|
||||
|
11
Core/Host.h
11
Core/Host.h
@ -58,11 +58,18 @@ public:
|
||||
|
||||
virtual void SendCoreWait(bool) {}
|
||||
|
||||
// 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 GPUAllowTextureCache(u32 addr) { return true; }
|
||||
|
||||
virtual bool GpuStep() { return false; }
|
||||
virtual void SendGPUStart() {}
|
||||
virtual void SendGPUWait(u32 cmd, u32 addr, void* data) {}
|
||||
virtual void SetGPUStep(bool value, int flag = 0, int data = 0) {}
|
||||
virtual void NextGPUStep() {}
|
||||
|
||||
virtual bool CanCreateShortcut() {return false;}
|
||||
virtual bool CreateDesktopShortcut(std::string argumentPath, std::string title) {return false;}
|
||||
|
||||
|
28
GPU/Common/GPUDebugInterface.h
Normal file
28
GPU/Common/GPUDebugInterface.h
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2012- 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
|
||||
|
||||
class GPUDebugInterface {
|
||||
public:
|
||||
// TODO:
|
||||
// current list / all lists
|
||||
// cmds / matrices / addresses
|
||||
// cached framebuffers / textures / vertices?
|
||||
// get content of framebuffer / texture
|
||||
// vertex / texture decoding?
|
||||
};
|
@ -470,6 +470,7 @@ void DIRECTX9_GPU::BeginFrameInternal() {
|
||||
}
|
||||
|
||||
void DIRECTX9_GPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {
|
||||
host->GPUNotifyDisplay(framebuf, stride, format);
|
||||
framebufferManager_.SetDisplayFramebuffer(framebuf, stride, format);
|
||||
}
|
||||
|
||||
|
@ -165,9 +165,10 @@ inline void AttachFramebufferValid(T &entry, VirtualFramebufferDX9 *framebuffer)
|
||||
const bool hasInvalidFramebuffer = entry->framebuffer == 0 || entry->invalidHint == -1;
|
||||
const bool hasOlderFramebuffer = entry->framebuffer != 0 && entry->framebuffer->last_frame_render < framebuffer->last_frame_render;
|
||||
if (hasInvalidFramebuffer || hasOlderFramebuffer) {
|
||||
entry->framebuffer = framebuffer;
|
||||
entry->invalidHint = 0;
|
||||
}
|
||||
entry->framebuffer = framebuffer;
|
||||
entry->invalidHint = 0;
|
||||
host->GPUNotifyTextureAttachment(entry->addr);
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -175,6 +176,7 @@ inline void AttachFramebufferInvalid(T &entry, VirtualFramebufferDX9 *framebuffe
|
||||
if (entry->framebuffer == 0 || entry->framebuffer == framebuffer) {
|
||||
entry->framebuffer = framebuffer;
|
||||
entry->invalidHint = -1;
|
||||
host->GPUNotifyTextureAttachment(entry->addr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -220,6 +222,7 @@ inline void TextureCacheDX9::AttachFramebuffer(TexCacheEntry *entry, u32 address
|
||||
inline void TextureCacheDX9::DetachFramebuffer(TexCacheEntry *entry, u32 address, VirtualFramebufferDX9 *framebuffer) {
|
||||
if (entry->framebuffer == framebuffer) {
|
||||
entry->framebuffer = 0;
|
||||
host->GPUNotifyTextureAttachment(entry->addr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1083,6 +1086,9 @@ void TextureCacheDX9::SetTexture() {
|
||||
// Validate the texture still matches the cache entry.
|
||||
int dim = gstate.texsize[0] & 0xF0F;
|
||||
bool match = entry->Matches(dim, format, maxLevel);
|
||||
#ifndef _XBOX
|
||||
match &= host->GPUAllowTextureCache(texaddr);
|
||||
#endif
|
||||
|
||||
// Check for FBO - slow!
|
||||
if (entry->framebuffer && match) {
|
||||
|
@ -1332,6 +1332,10 @@ rotateVBO:
|
||||
collectedVerts = 0;
|
||||
numDrawCalls = 0;
|
||||
prevPrim_ = GE_PRIM_INVALID;
|
||||
|
||||
#ifndef _XBOX
|
||||
host->GPUNotifyDraw();
|
||||
#endif
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -517,6 +517,7 @@ void GLES_GPU::BeginFrameInternal() {
|
||||
}
|
||||
|
||||
void GLES_GPU::SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {
|
||||
host->GPUNotifyDisplay(framebuf, stride, format);
|
||||
framebufferManager_.SetDisplayFramebuffer(framebuf, stride, format);
|
||||
}
|
||||
|
||||
|
@ -163,6 +163,7 @@ inline void AttachFramebufferValid(T &entry, VirtualFramebuffer *framebuffer) {
|
||||
if (hasInvalidFramebuffer || hasOlderFramebuffer) {
|
||||
entry->framebuffer = framebuffer;
|
||||
entry->invalidHint = 0;
|
||||
host->GPUNotifyTextureAttachment(entry->addr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -171,6 +172,7 @@ inline void AttachFramebufferInvalid(T &entry, VirtualFramebuffer *framebuffer)
|
||||
if (entry->framebuffer == 0 || entry->framebuffer == framebuffer) {
|
||||
entry->framebuffer = framebuffer;
|
||||
entry->invalidHint = -1;
|
||||
host->GPUNotifyTextureAttachment(entry->addr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -224,6 +226,7 @@ inline void TextureCache::AttachFramebuffer(TexCacheEntry *entry, u32 address, V
|
||||
inline void TextureCache::DetachFramebuffer(TexCacheEntry *entry, u32 address, VirtualFramebuffer *framebuffer) {
|
||||
if (entry->framebuffer == framebuffer) {
|
||||
entry->framebuffer = 0;
|
||||
host->GPUNotifyTextureAttachment(entry->addr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1039,6 +1042,9 @@ void TextureCache::SetTexture() {
|
||||
// Validate the texture still matches the cache entry.
|
||||
u16 dim = gstate.getTextureDimension(0);
|
||||
bool match = entry->Matches(dim, format, maxLevel);
|
||||
#ifndef USING_GLES2
|
||||
match &= host->GPUAllowTextureCache(texaddr);
|
||||
#endif
|
||||
|
||||
// Check for FBO - slow!
|
||||
if (entry->framebuffer && match) {
|
||||
|
@ -1228,4 +1228,8 @@ rotateVBO:
|
||||
collectedVerts = 0;
|
||||
numDrawCalls = 0;
|
||||
prevPrim_ = GE_PRIM_INVALID;
|
||||
|
||||
#ifndef USING_GLES2
|
||||
host->GPUNotifyDraw();
|
||||
#endif
|
||||
}
|
||||
|
@ -155,6 +155,7 @@
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\ext\xbrz\xbrz.h" />
|
||||
<ClInclude Include="Common\GPUDebugInterface.h" />
|
||||
<ClInclude Include="Common\IndexGenerator.h" />
|
||||
<ClInclude Include="Common\VertexDecoderCommon.h" />
|
||||
<ClInclude Include="Directx9\GPU_DX9.h" />
|
||||
|
@ -141,6 +141,9 @@
|
||||
<ClInclude Include="Common\TextureDecoder.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Common\GPUDebugInterface.h">
|
||||
<Filter>Common</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Math3D.cpp">
|
||||
|
@ -475,6 +475,7 @@ bool GPUCommon::InterpretList(DisplayList &list) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// TODO: Use new interface.
|
||||
#if defined(USING_QT_UI)
|
||||
if (host->GpuStep()) {
|
||||
host->SendGPUStart();
|
||||
@ -489,9 +490,8 @@ bool GPUCommon::InterpretList(DisplayList &list) {
|
||||
gpuState = list.pc == list.stall ? GPUSTATE_STALL : GPUSTATE_RUNNING;
|
||||
guard.unlock();
|
||||
|
||||
const bool dumpThisFrame = dumpThisFrame_;
|
||||
// TODO: Add check for displaylist debugger.
|
||||
const bool useFastRunLoop = !dumpThisFrame;
|
||||
const bool useDebugger = host->GPUDebuggingActive();
|
||||
const bool useFastRunLoop = !dumpThisFrame_ && !useDebugger;
|
||||
while (gpuState == GPUSTATE_RUNNING) {
|
||||
{
|
||||
easy_guard innerGuard(listLock);
|
||||
@ -537,9 +537,11 @@ void GPUCommon::SlowRunLoop(DisplayList &list)
|
||||
const bool dumpThisFrame = dumpThisFrame_;
|
||||
while (downcount > 0)
|
||||
{
|
||||
host->GPUNotifyCommand(list.pc);
|
||||
u32 op = Memory::ReadUnchecked_U32(list.pc);
|
||||
u32 cmd = op >> 24;
|
||||
|
||||
// TODO: Replace.
|
||||
#if defined(USING_QT_UI)
|
||||
if (host->GpuStep())
|
||||
host->SendGPUWait(cmd, list.pc, &gstate);
|
||||
|
@ -3,6 +3,7 @@
|
||||
#include "Common/Common.h"
|
||||
#include "Core/ThreadEventQueue.h"
|
||||
#include "GPU/GPUInterface.h"
|
||||
#include "GPU/Common/GPUDebugInterface.h"
|
||||
|
||||
#if defined(ANDROID)
|
||||
#include <atomic>
|
||||
|
@ -54,7 +54,9 @@ public:
|
||||
virtual void ExecuteOp(u32 op, u32 diff);
|
||||
|
||||
virtual void BeginFrame() {}
|
||||
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {}
|
||||
virtual void SetDisplayFramebuffer(u32 framebuf, u32 stride, GEBufferFormat format) {
|
||||
host->GPUNotifyDisplay(framebuf, stride, format);
|
||||
}
|
||||
virtual void CopyDisplayToOutput();
|
||||
virtual void UpdateStats();
|
||||
virtual void InvalidateCache(u32 addr, int size, GPUInvalidationType type);
|
||||
|
@ -15,6 +15,7 @@
|
||||
// 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 "../GPUState.h"
|
||||
#include "../GLES/VertexDecoder.h"
|
||||
|
||||
@ -258,6 +259,7 @@ void TransformUnit::SubmitSpline(void* control_points, void* indices, int count_
|
||||
}
|
||||
}
|
||||
delete[] patches;
|
||||
host->GPUNotifyDraw();
|
||||
}
|
||||
|
||||
void TransformUnit::SubmitPrimitive(void* vertices, void* indices, u32 prim_type, int vertex_count, u32 vertex_type)
|
||||
@ -402,4 +404,6 @@ void TransformUnit::SubmitPrimitive(void* vertices, void* indices, u32 prim_type
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
host->GPUNotifyDraw();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user