diff options
| author | 2018-03-24 23:35:06 -0500 | |
|---|---|---|
| committer | 2018-03-24 23:35:06 -0500 | |
| commit | 0ce52b1da2228f3325d94e52bead7335c8b07d1c (patch) | |
| tree | db027be43dcb9fecb99fc7f8e698d3affd7e28c2 /src | |
| parent | GPU: Added a function to retrieve the active textures for a shader stage. (diff) | |
| download | yuzu-0ce52b1da2228f3325d94e52bead7335c8b07d1c.tar.gz yuzu-0ce52b1da2228f3325d94e52bead7335c8b07d1c.tar.xz yuzu-0ce52b1da2228f3325d94e52bead7335c8b07d1c.zip | |
GPU: Make the debug_context variable a member of the frontend instead of a global.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/core.h | 11 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.cpp | 2 | ||||
| -rw-r--r-- | src/video_core/debug_utils/debug_utils.h | 2 | ||||
| -rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 24 | ||||
| -rw-r--r-- | src/yuzu/debugger/graphics/graphics_surface.cpp | 5 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 9 | ||||
| -rw-r--r-- | src/yuzu/main.h | 6 |
7 files changed, 40 insertions, 19 deletions
diff --git a/src/core/core.h b/src/core/core.h index 552c8f5ee..ade456cfc 100644 --- a/src/core/core.h +++ b/src/core/core.h | |||
| @@ -13,6 +13,7 @@ | |||
| 13 | #include "core/memory.h" | 13 | #include "core/memory.h" |
| 14 | #include "core/perf_stats.h" | 14 | #include "core/perf_stats.h" |
| 15 | #include "core/telemetry_session.h" | 15 | #include "core/telemetry_session.h" |
| 16 | #include "video_core/debug_utils/debug_utils.h" | ||
| 16 | #include "video_core/gpu.h" | 17 | #include "video_core/gpu.h" |
| 17 | 18 | ||
| 18 | class EmuWindow; | 19 | class EmuWindow; |
| @@ -135,6 +136,14 @@ public: | |||
| 135 | return *app_loader; | 136 | return *app_loader; |
| 136 | } | 137 | } |
| 137 | 138 | ||
| 139 | void SetGPUDebugContext(std::shared_ptr<Tegra::DebugContext> context) { | ||
| 140 | debug_context = std::move(context); | ||
| 141 | } | ||
| 142 | |||
| 143 | std::shared_ptr<Tegra::DebugContext> GetGPUDebugContext() const { | ||
| 144 | return debug_context; | ||
| 145 | } | ||
| 146 | |||
| 138 | private: | 147 | private: |
| 139 | /** | 148 | /** |
| 140 | * Initialize the emulated system. | 149 | * Initialize the emulated system. |
| @@ -154,6 +163,8 @@ private: | |||
| 154 | std::unique_ptr<Kernel::Scheduler> scheduler; | 163 | std::unique_ptr<Kernel::Scheduler> scheduler; |
| 155 | std::unique_ptr<Tegra::GPU> gpu_core; | 164 | std::unique_ptr<Tegra::GPU> gpu_core; |
| 156 | 165 | ||
| 166 | std::shared_ptr<Tegra::DebugContext> debug_context; | ||
| 167 | |||
| 157 | Kernel::SharedPtr<Kernel::Process> current_process; | 168 | Kernel::SharedPtr<Kernel::Process> current_process; |
| 158 | 169 | ||
| 159 | /// When true, signals that a reschedule should happen | 170 | /// When true, signals that a reschedule should happen |
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp index 73fd4d7a3..22d44aab2 100644 --- a/src/video_core/debug_utils/debug_utils.cpp +++ b/src/video_core/debug_utils/debug_utils.cpp | |||
| @@ -23,8 +23,6 @@ | |||
| 23 | 23 | ||
| 24 | namespace Tegra { | 24 | namespace Tegra { |
| 25 | 25 | ||
| 26 | std::shared_ptr<DebugContext> g_debug_context; | ||
| 27 | |||
| 28 | void DebugContext::DoOnEvent(Event event, void* data) { | 26 | void DebugContext::DoOnEvent(Event event, void* data) { |
| 29 | { | 27 | { |
| 30 | std::unique_lock<std::mutex> lock(breakpoint_mutex); | 28 | std::unique_lock<std::mutex> lock(breakpoint_mutex); |
diff --git a/src/video_core/debug_utils/debug_utils.h b/src/video_core/debug_utils/debug_utils.h index 98461d6d9..bbba8e380 100644 --- a/src/video_core/debug_utils/debug_utils.h +++ b/src/video_core/debug_utils/debug_utils.h | |||
| @@ -160,6 +160,4 @@ private: | |||
| 160 | std::list<BreakPointObserver*> breakpoint_observers; | 160 | std::list<BreakPointObserver*> breakpoint_observers; |
| 161 | }; | 161 | }; |
| 162 | 162 | ||
| 163 | extern std::shared_ptr<DebugContext> g_debug_context; | ||
| 164 | |||
| 165 | } // namespace Tegra | 163 | } // namespace Tegra |
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index c962887ca..986165c6d 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #include <cinttypes> | 5 | #include <cinttypes> |
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "core/core.h" | ||
| 7 | #include "video_core/debug_utils/debug_utils.h" | 8 | #include "video_core/debug_utils/debug_utils.h" |
| 8 | #include "video_core/engines/maxwell_3d.h" | 9 | #include "video_core/engines/maxwell_3d.h" |
| 9 | #include "video_core/textures/decoders.h" | 10 | #include "video_core/textures/decoders.h" |
| @@ -50,6 +51,8 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) { | |||
| 50 | ASSERT_MSG(method < Regs::NUM_REGS, | 51 | ASSERT_MSG(method < Regs::NUM_REGS, |
| 51 | "Invalid Maxwell3D register, increase the size of the Regs structure"); | 52 | "Invalid Maxwell3D register, increase the size of the Regs structure"); |
| 52 | 53 | ||
| 54 | auto debug_context = Core::System::GetInstance().GetGPUDebugContext(); | ||
| 55 | |||
| 53 | // It is an error to write to a register other than the current macro's ARG register before it | 56 | // It is an error to write to a register other than the current macro's ARG register before it |
| 54 | // has finished execution. | 57 | // has finished execution. |
| 55 | if (executing_macro != 0) { | 58 | if (executing_macro != 0) { |
| @@ -76,8 +79,8 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) { | |||
| 76 | return; | 79 | return; |
| 77 | } | 80 | } |
| 78 | 81 | ||
| 79 | if (Tegra::g_debug_context) { | 82 | if (debug_context) { |
| 80 | Tegra::g_debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandLoaded, nullptr); | 83 | debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandLoaded, nullptr); |
| 81 | } | 84 | } |
| 82 | 85 | ||
| 83 | regs.reg_array[method] = value; | 86 | regs.reg_array[method] = value; |
| @@ -146,9 +149,8 @@ void Maxwell3D::WriteReg(u32 method, u32 value, u32 remaining_params) { | |||
| 146 | 149 | ||
| 147 | #undef MAXWELL3D_REG_INDEX | 150 | #undef MAXWELL3D_REG_INDEX |
| 148 | 151 | ||
| 149 | if (Tegra::g_debug_context) { | 152 | if (debug_context) { |
| 150 | Tegra::g_debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandProcessed, | 153 | debug_context->OnEvent(Tegra::DebugContext::Event::MaxwellCommandProcessed, nullptr); |
| 151 | nullptr); | ||
| 152 | } | 154 | } |
| 153 | } | 155 | } |
| 154 | 156 | ||
| @@ -173,14 +175,14 @@ void Maxwell3D::ProcessQueryGet() { | |||
| 173 | 175 | ||
| 174 | void Maxwell3D::DrawArrays() { | 176 | void Maxwell3D::DrawArrays() { |
| 175 | LOG_WARNING(HW_GPU, "Game requested a DrawArrays, ignoring"); | 177 | LOG_WARNING(HW_GPU, "Game requested a DrawArrays, ignoring"); |
| 176 | if (Tegra::g_debug_context) { | 178 | auto debug_context = Core::System::GetInstance().GetGPUDebugContext(); |
| 177 | Tegra::g_debug_context->OnEvent(Tegra::DebugContext::Event::IncomingPrimitiveBatch, | 179 | |
| 178 | nullptr); | 180 | if (debug_context) { |
| 181 | debug_context->OnEvent(Tegra::DebugContext::Event::IncomingPrimitiveBatch, nullptr); | ||
| 179 | } | 182 | } |
| 180 | 183 | ||
| 181 | if (Tegra::g_debug_context) { | 184 | if (debug_context) { |
| 182 | Tegra::g_debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, | 185 | debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr); |
| 183 | nullptr); | ||
| 184 | } | 186 | } |
| 185 | } | 187 | } |
| 186 | 188 | ||
diff --git a/src/yuzu/debugger/graphics/graphics_surface.cpp b/src/yuzu/debugger/graphics/graphics_surface.cpp index d061013da..8e6509adc 100644 --- a/src/yuzu/debugger/graphics/graphics_surface.cpp +++ b/src/yuzu/debugger/graphics/graphics_surface.cpp | |||
| @@ -341,7 +341,10 @@ void GraphicsSurfaceWidget::OnUpdate() { | |||
| 341 | surface_address = rt.Address(); | 341 | surface_address = rt.Address(); |
| 342 | surface_width = rt.horiz; | 342 | surface_width = rt.horiz; |
| 343 | surface_height = rt.vert; | 343 | surface_height = rt.vert; |
| 344 | surface_format = ConvertToTextureFormat(static_cast<Tegra::RenderTargetFormat>(rt.format)); | 344 | if (rt.format != 0) { |
| 345 | surface_format = | ||
| 346 | ConvertToTextureFormat(static_cast<Tegra::RenderTargetFormat>(rt.format)); | ||
| 347 | } | ||
| 345 | 348 | ||
| 346 | break; | 349 | break; |
| 347 | } | 350 | } |
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index b8c23ae15..bd323870b 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -25,6 +25,7 @@ | |||
| 25 | #include "core/gdbstub/gdbstub.h" | 25 | #include "core/gdbstub/gdbstub.h" |
| 26 | #include "core/loader/loader.h" | 26 | #include "core/loader/loader.h" |
| 27 | #include "core/settings.h" | 27 | #include "core/settings.h" |
| 28 | #include "video_core/debug_utils/debug_utils.h" | ||
| 28 | #include "yuzu/about_dialog.h" | 29 | #include "yuzu/about_dialog.h" |
| 29 | #include "yuzu/bootmanager.h" | 30 | #include "yuzu/bootmanager.h" |
| 30 | #include "yuzu/configuration/config.h" | 31 | #include "yuzu/configuration/config.h" |
| @@ -71,7 +72,7 @@ void GMainWindow::ShowCallouts() {} | |||
| 71 | 72 | ||
| 72 | GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { | 73 | GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { |
| 73 | 74 | ||
| 74 | Tegra::g_debug_context = Tegra::DebugContext::Construct(); | 75 | debug_context = Tegra::DebugContext::Construct(); |
| 75 | 76 | ||
| 76 | setAcceptDrops(true); | 77 | setAcceptDrops(true); |
| 77 | ui.setupUi(this); | 78 | ui.setupUi(this); |
| @@ -165,12 +166,12 @@ void GMainWindow::InitializeDebugWidgets() { | |||
| 165 | connect(this, &GMainWindow::EmulationStopping, registersWidget, | 166 | connect(this, &GMainWindow::EmulationStopping, registersWidget, |
| 166 | &RegistersWidget::OnEmulationStopping); | 167 | &RegistersWidget::OnEmulationStopping); |
| 167 | 168 | ||
| 168 | graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(Tegra::g_debug_context, this); | 169 | graphicsBreakpointsWidget = new GraphicsBreakPointsWidget(debug_context, this); |
| 169 | addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget); | 170 | addDockWidget(Qt::RightDockWidgetArea, graphicsBreakpointsWidget); |
| 170 | graphicsBreakpointsWidget->hide(); | 171 | graphicsBreakpointsWidget->hide(); |
| 171 | debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction()); | 172 | debug_menu->addAction(graphicsBreakpointsWidget->toggleViewAction()); |
| 172 | 173 | ||
| 173 | graphicsSurfaceWidget = new GraphicsSurfaceWidget(Tegra::g_debug_context, this); | 174 | graphicsSurfaceWidget = new GraphicsSurfaceWidget(debug_context, this); |
| 174 | addDockWidget(Qt::RightDockWidgetArea, graphicsSurfaceWidget); | 175 | addDockWidget(Qt::RightDockWidgetArea, graphicsSurfaceWidget); |
| 175 | graphicsSurfaceWidget->hide(); | 176 | graphicsSurfaceWidget->hide(); |
| 176 | debug_menu->addAction(graphicsSurfaceWidget->toggleViewAction()); | 177 | debug_menu->addAction(graphicsSurfaceWidget->toggleViewAction()); |
| @@ -339,6 +340,8 @@ bool GMainWindow::LoadROM(const QString& filename) { | |||
| 339 | 340 | ||
| 340 | Core::System& system{Core::System::GetInstance()}; | 341 | Core::System& system{Core::System::GetInstance()}; |
| 341 | 342 | ||
| 343 | system.SetGPUDebugContext(debug_context); | ||
| 344 | |||
| 342 | const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())}; | 345 | const Core::System::ResultStatus result{system.Load(render_window, filename.toStdString())}; |
| 343 | 346 | ||
| 344 | Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt"); | 347 | Core::Telemetry().AddField(Telemetry::FieldType::App, "Frontend", "Qt"); |
diff --git a/src/yuzu/main.h b/src/yuzu/main.h index 0f89607c8..2471caf83 100644 --- a/src/yuzu/main.h +++ b/src/yuzu/main.h | |||
| @@ -23,6 +23,10 @@ class ProfilerWidget; | |||
| 23 | class RegistersWidget; | 23 | class RegistersWidget; |
| 24 | class WaitTreeWidget; | 24 | class WaitTreeWidget; |
| 25 | 25 | ||
| 26 | namespace Tegra { | ||
| 27 | class DebugContext; | ||
| 28 | } | ||
| 29 | |||
| 26 | class GMainWindow : public QMainWindow { | 30 | class GMainWindow : public QMainWindow { |
| 27 | Q_OBJECT | 31 | Q_OBJECT |
| 28 | 32 | ||
| @@ -135,6 +139,8 @@ private: | |||
| 135 | 139 | ||
| 136 | Ui::MainWindow ui; | 140 | Ui::MainWindow ui; |
| 137 | 141 | ||
| 142 | std::shared_ptr<Tegra::DebugContext> debug_context; | ||
| 143 | |||
| 138 | GRenderWindow* render_window; | 144 | GRenderWindow* render_window; |
| 139 | GameList* game_list; | 145 | GameList* game_list; |
| 140 | 146 | ||