summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/CMakeLists.txt1
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints.cpp3
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints.hxx27
-rw-r--r--src/citra_qt/debugger/graphics_breakpoints_p.hxx38
-rw-r--r--src/citra_qt/debugger/graphics_cmdlists.cpp54
-rw-r--r--src/citra_qt/debugger/graphics_framebuffer.cpp4
-rw-r--r--src/common/common_funcs.h2
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp4
8 files changed, 66 insertions, 67 deletions
diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt
index cd4a04eac..90e5c6aa6 100644
--- a/src/citra_qt/CMakeLists.txt
+++ b/src/citra_qt/CMakeLists.txt
@@ -27,6 +27,7 @@ set(HEADERS
27 debugger/disassembler.hxx 27 debugger/disassembler.hxx
28 debugger/graphics.hxx 28 debugger/graphics.hxx
29 debugger/graphics_breakpoints.hxx 29 debugger/graphics_breakpoints.hxx
30 debugger/graphics_breakpoints_p.hxx
30 debugger/graphics_cmdlists.hxx 31 debugger/graphics_cmdlists.hxx
31 debugger/graphics_framebuffer.hxx 32 debugger/graphics_framebuffer.hxx
32 debugger/ramview.hxx 33 debugger/ramview.hxx
diff --git a/src/citra_qt/debugger/graphics_breakpoints.cpp b/src/citra_qt/debugger/graphics_breakpoints.cpp
index 2f41d5f77..db98a3b05 100644
--- a/src/citra_qt/debugger/graphics_breakpoints.cpp
+++ b/src/citra_qt/debugger/graphics_breakpoints.cpp
@@ -9,6 +9,7 @@
9#include <QLabel> 9#include <QLabel>
10 10
11#include "graphics_breakpoints.hxx" 11#include "graphics_breakpoints.hxx"
12#include "graphics_breakpoints_p.hxx"
12 13
13BreakPointModel::BreakPointModel(std::shared_ptr<Pica::DebugContext> debug_context, QObject* parent) 14BreakPointModel::BreakPointModel(std::shared_ptr<Pica::DebugContext> debug_context, QObject* parent)
14 : QAbstractListModel(parent), context_weak(debug_context), 15 : QAbstractListModel(parent), context_weak(debug_context),
@@ -39,7 +40,7 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const
39 std::map<Pica::DebugContext::Event, QString> map; 40 std::map<Pica::DebugContext::Event, QString> map;
40 map.insert({Pica::DebugContext::Event::CommandLoaded, tr("Pica command loaded")}); 41 map.insert({Pica::DebugContext::Event::CommandLoaded, tr("Pica command loaded")});
41 map.insert({Pica::DebugContext::Event::CommandProcessed, tr("Pica command processed")}); 42 map.insert({Pica::DebugContext::Event::CommandProcessed, tr("Pica command processed")});
42 map.insert({Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incomming primitive batch")}); 43 map.insert({Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")});
43 map.insert({Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")}); 44 map.insert({Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")});
44 45
45 _dbg_assert_(GPU, map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents)); 46 _dbg_assert_(GPU, map.size() == static_cast<size_t>(Pica::DebugContext::Event::NumEvents));
diff --git a/src/citra_qt/debugger/graphics_breakpoints.hxx b/src/citra_qt/debugger/graphics_breakpoints.hxx
index edc41283e..2142c6fa1 100644
--- a/src/citra_qt/debugger/graphics_breakpoints.hxx
+++ b/src/citra_qt/debugger/graphics_breakpoints.hxx
@@ -15,32 +15,7 @@ class QLabel;
15class QPushButton; 15class QPushButton;
16class QTreeView; 16class QTreeView;
17 17
18class BreakPointModel : public QAbstractListModel { 18class BreakPointModel;
19 Q_OBJECT
20
21public:
22 enum {
23 Role_IsEnabled = Qt::UserRole,
24 };
25
26 BreakPointModel(std::shared_ptr<Pica::DebugContext> context, QObject* parent);
27
28 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
29 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
30 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
31 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
32
33 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
34
35public slots:
36 void OnBreakPointHit(Pica::DebugContext::Event event);
37 void OnResumed();
38
39private:
40 bool at_breakpoint;
41 Pica::DebugContext::Event active_breakpoint;
42 std::weak_ptr<Pica::DebugContext> context_weak;
43};
44 19
45class GraphicsBreakPointsWidget : public QDockWidget, Pica::DebugContext::BreakPointObserver { 20class GraphicsBreakPointsWidget : public QDockWidget, Pica::DebugContext::BreakPointObserver {
46 Q_OBJECT 21 Q_OBJECT
diff --git a/src/citra_qt/debugger/graphics_breakpoints_p.hxx b/src/citra_qt/debugger/graphics_breakpoints_p.hxx
new file mode 100644
index 000000000..bf5daf73d
--- /dev/null
+++ b/src/citra_qt/debugger/graphics_breakpoints_p.hxx
@@ -0,0 +1,38 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include <memory>
8
9#include <QAbstractListModel>
10
11#include "video_core/debug_utils/debug_utils.h"
12
13class BreakPointModel : public QAbstractListModel {
14 Q_OBJECT
15
16public:
17 enum {
18 Role_IsEnabled = Qt::UserRole,
19 };
20
21 BreakPointModel(std::shared_ptr<Pica::DebugContext> context, QObject* parent);
22
23 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
24 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
25 QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
26 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
27
28 bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
29
30public slots:
31 void OnBreakPointHit(Pica::DebugContext::Event event);
32 void OnResumed();
33
34private:
35 std::weak_ptr<Pica::DebugContext> context_weak;
36 bool at_breakpoint;
37 Pica::DebugContext::Event active_breakpoint;
38};
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp
index 4f58e9a90..ed51f97f3 100644
--- a/src/citra_qt/debugger/graphics_cmdlists.cpp
+++ b/src/citra_qt/debugger/graphics_cmdlists.cpp
@@ -124,59 +124,49 @@ TextureInfoDockWidget::TextureInfoDockWidget(const Pica::DebugUtils::TextureInfo
124 setWidget(main_widget); 124 setWidget(main_widget);
125} 125}
126 126
127void TextureInfoDockWidget::OnAddressChanged(qint64 value) 127void TextureInfoDockWidget::OnAddressChanged(qint64 value) {
128{
129 info.address = value; 128 info.address = value;
130 emit UpdatePixmap(ReloadPixmap()); 129 emit UpdatePixmap(ReloadPixmap());
131} 130}
132 131
133void TextureInfoDockWidget::OnFormatChanged(int value) 132void TextureInfoDockWidget::OnFormatChanged(int value) {
134{
135 info.format = static_cast<Pica::Regs::TextureFormat>(value); 133 info.format = static_cast<Pica::Regs::TextureFormat>(value);
136 emit UpdatePixmap(ReloadPixmap()); 134 emit UpdatePixmap(ReloadPixmap());
137} 135}
138 136
139void TextureInfoDockWidget::OnWidthChanged(int value) 137void TextureInfoDockWidget::OnWidthChanged(int value) {
140{
141 info.width = value; 138 info.width = value;
142 emit UpdatePixmap(ReloadPixmap()); 139 emit UpdatePixmap(ReloadPixmap());
143} 140}
144 141
145void TextureInfoDockWidget::OnHeightChanged(int value) 142void TextureInfoDockWidget::OnHeightChanged(int value) {
146{
147 info.height = value; 143 info.height = value;
148 emit UpdatePixmap(ReloadPixmap()); 144 emit UpdatePixmap(ReloadPixmap());
149} 145}
150 146
151void TextureInfoDockWidget::OnStrideChanged(int value) 147void TextureInfoDockWidget::OnStrideChanged(int value) {
152{
153 info.stride = value; 148 info.stride = value;
154 emit UpdatePixmap(ReloadPixmap()); 149 emit UpdatePixmap(ReloadPixmap());
155} 150}
156 151
157QPixmap TextureInfoDockWidget::ReloadPixmap() const 152QPixmap TextureInfoDockWidget::ReloadPixmap() const {
158{
159 u8* src = Memory::GetPointer(info.address); 153 u8* src = Memory::GetPointer(info.address);
160 return QPixmap::fromImage(LoadTexture(src, info)); 154 return QPixmap::fromImage(LoadTexture(src, info));
161} 155}
162 156
163GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) 157GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) {
164{
165 158
166} 159}
167 160
168int GPUCommandListModel::rowCount(const QModelIndex& parent) const 161int GPUCommandListModel::rowCount(const QModelIndex& parent) const {
169{
170 return pica_trace.writes.size(); 162 return pica_trace.writes.size();
171} 163}
172 164
173int GPUCommandListModel::columnCount(const QModelIndex& parent) const 165int GPUCommandListModel::columnCount(const QModelIndex& parent) const {
174{
175 return 2; 166 return 2;
176} 167}
177 168
178QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const 169QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const {
179{
180 if (!index.isValid()) 170 if (!index.isValid())
181 return QVariant(); 171 return QVariant();
182 172
@@ -202,8 +192,7 @@ QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const
202 return QVariant(); 192 return QVariant();
203} 193}
204 194
205QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientation, int role) const 195QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientation, int role) const {
206{
207 switch(role) { 196 switch(role) {
208 case Qt::DisplayRole: 197 case Qt::DisplayRole:
209 { 198 {
@@ -220,8 +209,7 @@ QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientatio
220 return QVariant(); 209 return QVariant();
221} 210}
222 211
223void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace) 212void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace) {
224{
225 beginResetModel(); 213 beginResetModel();
226 214
227 pica_trace = trace; 215 pica_trace = trace;
@@ -233,20 +221,19 @@ void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace&
233 (cmd_id >= PICA_REG_INDEX(reg_name) && \ 221 (cmd_id >= PICA_REG_INDEX(reg_name) && \
234 cmd_id < PICA_REG_INDEX(reg_name) + sizeof(decltype(Pica::registers.reg_name)) / 4) 222 cmd_id < PICA_REG_INDEX(reg_name) + sizeof(decltype(Pica::registers.reg_name)) / 4)
235 223
236void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) 224void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
237{
238
239 const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); 225 const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt();
240 if (COMMAND_IN_RANGE(command_id, texture0)) { 226 if (COMMAND_IN_RANGE(command_id, texture0)) {
241 auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(Pica::registers.texture0, 227 auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(Pica::registers.texture0,
242 Pica::registers.texture0_format); 228 Pica::registers.texture0_format);
243 QMainWindow* main_window = (QMainWindow*)parent(); 229
230 // TODO: Instead, emit a signal here to be caught by the main window widget.
231 auto main_window = static_cast<QMainWindow*>(parent());
244 main_window->tabifyDockWidget(this, new TextureInfoDockWidget(info, main_window)); 232 main_window->tabifyDockWidget(this, new TextureInfoDockWidget(info, main_window));
245 } 233 }
246} 234}
247 235
248void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) 236void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
249{
250 QWidget* new_info_widget; 237 QWidget* new_info_widget;
251 238
252 const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt(); 239 const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt();
@@ -266,8 +253,7 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index)
266} 253}
267#undef COMMAND_IN_RANGE 254#undef COMMAND_IN_RANGE
268 255
269GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pica Command List"), parent) 256GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pica Command List"), parent) {
270{
271 setObjectName("Pica Command List"); 257 setObjectName("Pica Command List");
272 GPUCommandListModel* model = new GPUCommandListModel(this); 258 GPUCommandListModel* model = new GPUCommandListModel(this);
273 259
@@ -283,7 +269,6 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
283 connect(list_widget, SIGNAL(doubleClicked(const QModelIndex&)), 269 connect(list_widget, SIGNAL(doubleClicked(const QModelIndex&)),
284 this, SLOT(OnCommandDoubleClicked(const QModelIndex&))); 270 this, SLOT(OnCommandDoubleClicked(const QModelIndex&)));
285 271
286
287 toggle_tracing = new QPushButton(tr("Start Tracing")); 272 toggle_tracing = new QPushButton(tr("Start Tracing"));
288 273
289 connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing())); 274 connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing()));
@@ -301,8 +286,7 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
301 setWidget(main_widget); 286 setWidget(main_widget);
302} 287}
303 288
304void GPUCommandListWidget::OnToggleTracing() 289void GPUCommandListWidget::OnToggleTracing() {
305{
306 if (!Pica::DebugUtils::IsPicaTracing()) { 290 if (!Pica::DebugUtils::IsPicaTracing()) {
307 Pica::DebugUtils::StartPicaTracing(); 291 Pica::DebugUtils::StartPicaTracing();
308 toggle_tracing->setText(tr("Stop Tracing")); 292 toggle_tracing->setText(tr("Stop Tracing"));
diff --git a/src/citra_qt/debugger/graphics_framebuffer.cpp b/src/citra_qt/debugger/graphics_framebuffer.cpp
index b91db5433..ac47f298d 100644
--- a/src/citra_qt/debugger/graphics_framebuffer.cpp
+++ b/src/citra_qt/debugger/graphics_framebuffer.cpp
@@ -217,11 +217,11 @@ void GraphicsFramebufferWidget::OnUpdate()
217 break; 217 break;
218 } 218 }
219 219
220 // TODO: Implement a good way to visualize alpha components!
221 // TODO: Unify this decoding code with the texture decoder
220 switch (framebuffer_format) { 222 switch (framebuffer_format) {
221 case Format::RGBA8: 223 case Format::RGBA8:
222 { 224 {
223 // TODO: Implement a good way to visualize the alpha component
224
225 QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32); 225 QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
226 u32* color_buffer = (u32*)Memory::GetPointer(framebuffer_address); 226 u32* color_buffer = (u32*)Memory::GetPointer(framebuffer_address);
227 for (int y = 0; y < framebuffer_height; ++y) { 227 for (int y = 0; y < framebuffer_height; ++y) {
diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h
index 3f6df075a..db041780a 100644
--- a/src/common/common_funcs.h
+++ b/src/common/common_funcs.h
@@ -39,6 +39,8 @@ template<> struct CompileTimeAssert<true> {};
39#include <sys/endian.h> 39#include <sys/endian.h>
40#endif 40#endif
41 41
42#include "common_types.h"
43
42// go to debugger mode 44// go to debugger mode
43 #ifdef GEKKO 45 #ifdef GEKKO
44 #define Crash() 46 #define Crash()
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index 31ce09faf..71b03f31c 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -2,8 +2,6 @@
2// Licensed under GPLv2 2// Licensed under GPLv2
3// Refer to the license.txt file included. 3// Refer to the license.txt file included.
4 4
5#include <cassert>
6
7#include <algorithm> 5#include <algorithm>
8#include <condition_variable> 6#include <condition_variable>
9#include <list> 7#include <list>
@@ -359,7 +357,7 @@ std::unique_ptr<PicaTrace> FinishPicaTracing()
359} 357}
360 358
361const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info) { 359const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info) {
362 assert(info.format == Pica::Regs::TextureFormat::RGB8); 360 _dbg_assert_(GPU, info.format == Pica::Regs::TextureFormat::RGB8);
363 361
364 // Cf. rasterizer code for an explanation of this algorithm. 362 // Cf. rasterizer code for an explanation of this algorithm.
365 int texel_index_within_tile = 0; 363 int texel_index_within_tile = 0;