mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-12-26 04:40:06 +00:00
GPU: Make the debug_context variable a member of the frontend instead of a global.
This commit is contained in:
parent
2c785bd06c
commit
0ce52b1da2
@ -13,6 +13,7 @@
|
|||||||
#include "core/memory.h"
|
#include "core/memory.h"
|
||||||
#include "core/perf_stats.h"
|
#include "core/perf_stats.h"
|
||||||
#include "core/telemetry_session.h"
|
#include "core/telemetry_session.h"
|
||||||
|
#include "video_core/debug_utils/debug_utils.h"
|
||||||
#include "video_core/gpu.h"
|
#include "video_core/gpu.h"
|
||||||
|
|
||||||
class EmuWindow;
|
class EmuWindow;
|
||||||
@ -135,6 +136,14 @@ public:
|
|||||||
return *app_loader;
|
return *app_loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetGPUDebugContext(std::shared_ptr<Tegra::DebugContext> context) {
|
||||||
|
debug_context = std::move(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Tegra::DebugContext> GetGPUDebugContext() const {
|
||||||
|
return debug_context;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* Initialize the emulated system.
|
* Initialize the emulated system.
|
||||||
@ -154,6 +163,8 @@ private:
|
|||||||
std::unique_ptr<Kernel::Scheduler> scheduler;
|
std::unique_ptr<Kernel::Scheduler> scheduler;
|
||||||
std::unique_ptr<Tegra::GPU> gpu_core;
|
std::unique_ptr<Tegra::GPU> gpu_core;
|
||||||
|
|
||||||
|
std::shared_ptr<Tegra::DebugContext> debug_context;
|
||||||
|
|
||||||
Kernel::SharedPtr<Kernel::Process> current_process;
|
Kernel::SharedPtr<Kernel::Process> current_process;
|
||||||
|
|
||||||
/// When true, signals that a reschedule should happen
|
/// When true, signals that a reschedule should happen
|
||||||
|
@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
namespace Tegra {
|
namespace Tegra {
|
||||||
|
|
||||||
std::shared_ptr<DebugContext> g_debug_context;
|
|
||||||
|
|
||||||
void DebugContext::DoOnEvent(Event event, void* data) {
|
void DebugContext::DoOnEvent(Event event, void* data) {
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(breakpoint_mutex);
|
std::unique_lock<std::mutex> lock(breakpoint_mutex);
|
||||||
|
@ -160,6 +160,4 @@ private:
|
|||||||
std::list<BreakPointObserver*> breakpoint_observers;
|
std::list<BreakPointObserver*> breakpoint_observers;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern std::shared_ptr<DebugContext> g_debug_context;
|
|
||||||
|
|
||||||
} // namespace Tegra
|
} // namespace Tegra
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#include <cinttypes>
|
#include <cinttypes>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
|
#include "core/core.h"
|
||||||
#include "video_core/debug_utils/debug_utils.h"
|
#include "video_core/debug_utils/debug_utils.h"
|
||||||
#include "video_core/engines/maxwell_3d.h"
|
#include "video_core/engines/maxwell_3d.h"
|
||||||
#include "video_core/textures/decoders.h"
|
#include "video_core/textures/decoders.h"
|
||||||
@ -50,6 +51,8 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) {
|
|||||||
ASSERT_MSG(method < Regs::NUM_REGS,
|
ASSERT_MSG(method < Regs::NUM_REGS,
|
||||||
"Invalid Maxwell3D register, increase the size of the Regs structure");
|
"Invalid Maxwell3D register, increase the size of the Regs structure");
|
||||||
|
|
||||||
|
auto debug_context = Core::System::GetInstance().GetGPUDebugContext();
|
||||||
|
|
||||||
// It is an error to write to a register other than the current macro's ARG register before it
|
// It is an error to write to a register other than the current macro's ARG register before it
|
||||||
// has finished execution.
|
// has finished execution.
|
||||||
if (executing_macro != 0) {
|
if (executing_macro != 0) {
|
||||||
@ -76,8 +79,8 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tegra::g_debug_context) {
|
if (debug_context) {
|
||||||
Tegra::g_debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandLoaded, nullptr);
|
debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandLoaded, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
regs.reg_array[method] = value;
|
regs.reg_array[method] = value;
|
||||||
@ -146,9 +149,8 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) {
|
|||||||
|
|
||||||
#undef MAXWELL3D_REG_INDEX
|
#undef MAXWELL3D_REG_INDEX
|
||||||
|
|
||||||
if (Tegra::g_debug_context) {
|
if (debug_context) {
|
||||||
Tegra::g_debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandProcessed,
|
debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandProcessed, nullptr);
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,14 +175,14 @@ void Maxwell3D::ProcessQueryGet() {
|
|||||||
|
|
||||||
void Maxwell3D::DrawArrays() {
|
void Maxwell3D::DrawArrays() {
|
||||||
LOG_WARNING(HW_GPU, "Game requested a DrawArrays, ignoring");
|
LOG_WARNING(HW_GPU, "Game requested a DrawArrays, ignoring");
|
||||||
if (Tegra::g_debug_context) {
|
auto debug_context = Core::System::GetInstance().GetGPUDebugContext();
|
||||||
Tegra::g_debug_context->OnEvent(Tegra::DebugContext::Event::IncomingPrimitiveBatch,
|
|
||||||
nullptr);
|
if (debug_context) {
|
||||||
|
debug_context->OnEvent(Tegra::DebugContext::Event::IncomingPrimitiveBatch, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tegra::g_debug_context) {
|
if (debug_context) {
|
||||||
Tegra::g_debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch,
|
debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr);
|
||||||
nullptr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,10 @@ void GraphicsSurfaceWidget::OnUpdate() {
|
|||||||
surface_address = rt.Address();
|
surface_address = rt.Address();
|
||||||
surface_width = rt.horiz;
|
surface_width = rt.horiz;
|
||||||
surface_height = rt.vert;
|
surface_height = rt.vert;
|
||||||
surface_format = ConvertToTextureFormat(static_cast<Tegra::RenderTargetFormat>(rt.format));
|
if (rt.format != 0) {
|
||||||
|
surface_format =
|
||||||
|
ConvertToTextureFormat(static_cast<Tegra::RenderTargetFormat>(rt.format));
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
#include "core/gdbstub/gdbstub.h"
|
#include "core/gdbstub/gdbstub.h"
|
||||||
#include "core/loader/loader.h"
|
#include "core/loader/loader.h"
|
||||||
#include "core/settings.h"
|
#include "core/settings.h"
|
||||||
|
#include "video_core/debug_utils/debug_utils.h"
|
||||||
#include "yuzu/about_dialog.h"
|
#include "yuzu/about_dialog.h"
|
||||||
#include "yuzu/bootmanager.h"
|
#include "yuzu/bootmanager.h"
|
||||||
#include "yuzu/configuration/config.h"
|
#include "yuzu/configuration/config.h"
|
||||||
@ -71,7 +72,7 @@ void GMainWindow::ShowCallouts() {}
|
|||||||
|
|
||||||
GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) {
|
||||||
|
|
||||||
Tegra::g_debug_context = Tegra::DebugContext::Construct();
|
debug_context = Tegra::DebugContext::Construct();
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
@ -165,12 +166,12 @@ void GMainWindow::InitializeDebugWidgets() {
|
|||||||
connect(this, &GMainWindow::EmulationStopping, registersWidget,
|
connect(this, &GMainWindow::EmulationStopping, registersWidget,
|
||||||
&RegistersWidget::OnEmulationStopping);
|
&RegistersWidget::OnEmulationStopping);
|
||||||
|
|
||||||
graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(Tegra::g_debug_context, this);
|
graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(debug_context, this);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget);
|
addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget);
|
||||||
graphicsBreakpointsWidget->hide();
|
graphicsBreakpointsWidget->hide();
|
||||||
debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction());
|
debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction());
|
||||||
|
|
||||||
graphicsSurfaceWidget = new GraphicsSurfaceWidget(Tegra::g_debug_context, this);
|
graphicsSurfaceWidget = new GraphicsSurfaceWidget(debug_context, this);
|
||||||
addDockWidget(Qt::RightDockWidgetArea, graphicsSurfaceWidget);
|
addDockWidget(Qt::RightDockWidgetArea, graphicsSurfaceWidget);
|
||||||
graphicsSurfaceWidget->hide();
|
graphicsSurfaceWidget->hide();
|
||||||
debug_menu->addAction(graphicsSurfaceWidget->toggleViewAction());
|
debug_menu->addAction(graphicsSurfaceWidget->toggleViewAction());
|
||||||
@ -339,6 +340,8 @@ bool GMainWindow::LoadROM(const QString& filename) {
|
|||||||
|
|
||||||
Core::System& system{Core::System::GetInstance()};
|
Core::System& system{Core::System::GetInstance()};
|
||||||
|
|
||||||
|
system.SetGPUDebugContext(debug_context);
|
||||||
|
|
||||||
const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())};
|
const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())};
|
||||||
|
|
||||||
Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt");
|
Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt");
|
||||||
|
@ -23,6 +23,10 @@ class ProfilerWidget;
|
|||||||
class RegistersWidget;
|
class RegistersWidget;
|
||||||
class WaitTreeWidget;
|
class WaitTreeWidget;
|
||||||
|
|
||||||
|
namespace Tegra {
|
||||||
|
class DebugContext;
|
||||||
|
}
|
||||||
|
|
||||||
class GMainWindow : public QMainWindow {
|
class GMainWindow : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -135,6 +139,8 @@ private:
|
|||||||
|
|
||||||
Ui::MainWindow ui;
|
Ui::MainWindow ui;
|
||||||
|
|
||||||
|
std::shared_ptr<Tegra::DebugContext> debug_context;
|
||||||
|
|
||||||
GRenderWindow* render_window;
|
GRenderWindow* render_window;
|
||||||
GameList* game_list;
|
GameList* game_list;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user