summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Wasserka <NeoBrainX@gmail.com>2014-12-04 19:41:03 +0100
committerTony Wasserka <NeoBrainX@gmail.com>2014-12-09 16:37:34 +0100
commit0cd27a511ecd170484b672263c09192b579e31ac (patch)
treedfa2dece82fcbcfe45708582a493ee0ff317ce82
parentcitra-qt: Add pica framebuffer widget. (diff)
downloadyuzu-0cd27a511ecd170484b672263c09192b579e31ac.tar
yuzu-0cd27a511ecd170484b672263c09192b579e31ac.tar.gz
yuzu-0cd27a511ecd170484b672263c09192b579e31ac.tar.bz2
yuzu-0cd27a511ecd170484b672263c09192b579e31ac.tar.lz
yuzu-0cd27a511ecd170484b672263c09192b579e31ac.tar.xz
yuzu-0cd27a511ecd170484b672263c09192b579e31ac.tar.zst
yuzu-0cd27a511ecd170484b672263c09192b579e31ac.zip
-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
debugger/disassembler.hxx
debugger/graphics.hxx
debugger/graphics_breakpoints.hxx
+ debugger/graphics_breakpoints_p.hxx
debugger/graphics_cmdlists.hxx
debugger/graphics_framebuffer.hxx
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 @@
#include <QLabel>
#include "graphics_breakpoints.hxx"
+#include "graphics_breakpoints_p.hxx"
BreakPointModel::BreakPointModel(std::shared_ptr<Pica::DebugContext> debug_context, QObject* parent)
: QAbstractListModel(parent), context_weak(debug_context),
@@ -39,7 +40,7 @@ QVariant BreakPointModel::data(const QModelIndex& index, int role) const
std::map<Pica::DebugContext::Event, QString> map;
map.insert({Pica::DebugContext::Event::CommandLoaded, tr("Pica command loaded")});
map.insert({Pica::DebugContext::Event::CommandProcessed, tr("Pica command processed")});
- map.insert({Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incomming primitive batch")});
+ map.insert({Pica::DebugContext::Event::IncomingPrimitiveBatch, tr("Incoming primitive batch")});
map.insert({Pica::DebugContext::Event::FinishedPrimitiveBatch, tr("Finished primitive batch")});
_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;
class QPushButton;
class QTreeView;
-class BreakPointModel : public QAbstractListModel {
- Q_OBJECT
-
-public:
- enum {
- Role_IsEnabled = Qt::UserRole,
- };
-
- BreakPointModel(std::shared_ptr<Pica::DebugContext> context, QObject* parent);
-
- int columnCount(const QModelIndex& parent = QModelIndex()) const override;
- int rowCount(const QModelIndex& parent = QModelIndex()) const override;
- QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
- QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
-
- bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
-
-public slots:
- void OnBreakPointHit(Pica::DebugContext::Event event);
- void OnResumed();
-
-private:
- bool at_breakpoint;
- Pica::DebugContext::Event active_breakpoint;
- std::weak_ptr<Pica::DebugContext> context_weak;
-};
+class BreakPointModel;
class GraphicsBreakPointsWidget : public QDockWidget, Pica::DebugContext::BreakPointObserver {
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 @@
+// Copyright 2014 Citra Emulator Project
+// Licensed under GPLv2
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <memory>
+
+#include <QAbstractListModel>
+
+#include "video_core/debug_utils/debug_utils.h"
+
+class BreakPointModel : public QAbstractListModel {
+ Q_OBJECT
+
+public:
+ enum {
+ Role_IsEnabled = Qt::UserRole,
+ };
+
+ BreakPointModel(std::shared_ptr<Pica::DebugContext> context, QObject* parent);
+
+ int columnCount(const QModelIndex& parent = QModelIndex()) const override;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const override;
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
+ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
+
+ bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+
+public slots:
+ void OnBreakPointHit(Pica::DebugContext::Event event);
+ void OnResumed();
+
+private:
+ std::weak_ptr<Pica::DebugContext> context_weak;
+ bool at_breakpoint;
+ Pica::DebugContext::Event active_breakpoint;
+};
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
setWidget(main_widget);
}
-void TextureInfoDockWidget::OnAddressChanged(qint64 value)
-{
+void TextureInfoDockWidget::OnAddressChanged(qint64 value) {
info.address = value;
emit UpdatePixmap(ReloadPixmap());
}
-void TextureInfoDockWidget::OnFormatChanged(int value)
-{
+void TextureInfoDockWidget::OnFormatChanged(int value) {
info.format = static_cast<Pica::Regs::TextureFormat>(value);
emit UpdatePixmap(ReloadPixmap());
}
-void TextureInfoDockWidget::OnWidthChanged(int value)
-{
+void TextureInfoDockWidget::OnWidthChanged(int value) {
info.width = value;
emit UpdatePixmap(ReloadPixmap());
}
-void TextureInfoDockWidget::OnHeightChanged(int value)
-{
+void TextureInfoDockWidget::OnHeightChanged(int value) {
info.height = value;
emit UpdatePixmap(ReloadPixmap());
}
-void TextureInfoDockWidget::OnStrideChanged(int value)
-{
+void TextureInfoDockWidget::OnStrideChanged(int value) {
info.stride = value;
emit UpdatePixmap(ReloadPixmap());
}
-QPixmap TextureInfoDockWidget::ReloadPixmap() const
-{
+QPixmap TextureInfoDockWidget::ReloadPixmap() const {
u8* src = Memory::GetPointer(info.address);
return QPixmap::fromImage(LoadTexture(src, info));
}
-GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent)
-{
+GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) {
}
-int GPUCommandListModel::rowCount(const QModelIndex& parent) const
-{
+int GPUCommandListModel::rowCount(const QModelIndex& parent) const {
return pica_trace.writes.size();
}
-int GPUCommandListModel::columnCount(const QModelIndex& parent) const
-{
+int GPUCommandListModel::columnCount(const QModelIndex& parent) const {
return 2;
}
-QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const
-{
+QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const {
if (!index.isValid())
return QVariant();
@@ -202,8 +192,7 @@ QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const
return QVariant();
}
-QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
+QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientation, int role) const {
switch(role) {
case Qt::DisplayRole:
{
@@ -220,8 +209,7 @@ QVariant GPUCommandListModel::headerData(int section, Qt::Orientation orientatio
return QVariant();
}
-void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace)
-{
+void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace& trace) {
beginResetModel();
pica_trace = trace;
@@ -233,20 +221,19 @@ void GPUCommandListModel::OnPicaTraceFinished(const Pica::DebugUtils::PicaTrace&
(cmd_id >= PICA_REG_INDEX(reg_name) && \
cmd_id < PICA_REG_INDEX(reg_name) + sizeof(decltype(Pica::registers.reg_name)) / 4)
-void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index)
-{
-
+void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt();
if (COMMAND_IN_RANGE(command_id, texture0)) {
auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(Pica::registers.texture0,
Pica::registers.texture0_format);
- QMainWindow* main_window = (QMainWindow*)parent();
+
+ // TODO: Instead, emit a signal here to be caught by the main window widget.
+ auto main_window = static_cast<QMainWindow*>(parent());
main_window->tabifyDockWidget(this, new TextureInfoDockWidget(info, main_window));
}
}
-void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index)
-{
+void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
QWidget* new_info_widget;
const int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toInt();
@@ -266,8 +253,7 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index)
}
#undef COMMAND_IN_RANGE
-GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pica Command List"), parent)
-{
+GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pica Command List"), parent) {
setObjectName("Pica Command List");
GPUCommandListModel* model = new GPUCommandListModel(this);
@@ -283,7 +269,6 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
connect(list_widget, SIGNAL(doubleClicked(const QModelIndex&)),
this, SLOT(OnCommandDoubleClicked(const QModelIndex&)));
-
toggle_tracing = new QPushButton(tr("Start Tracing"));
connect(toggle_tracing, SIGNAL(clicked()), this, SLOT(OnToggleTracing()));
@@ -301,8 +286,7 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi
setWidget(main_widget);
}
-void GPUCommandListWidget::OnToggleTracing()
-{
+void GPUCommandListWidget::OnToggleTracing() {
if (!Pica::DebugUtils::IsPicaTracing()) {
Pica::DebugUtils::StartPicaTracing();
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()
break;
}
+ // TODO: Implement a good way to visualize alpha components!
+ // TODO: Unify this decoding code with the texture decoder
switch (framebuffer_format) {
case Format::RGBA8:
{
- // TODO: Implement a good way to visualize the alpha component
-
QImage decoded_image(framebuffer_width, framebuffer_height, QImage::Format_ARGB32);
u32* color_buffer = (u32*)Memory::GetPointer(framebuffer_address);
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> {};
#include <sys/endian.h>
#endif
+#include "common_types.h"
+
// go to debugger mode
#ifdef GEKKO
#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 @@
// Licensed under GPLv2
// Refer to the license.txt file included.
-#include <cassert>
-
#include <algorithm>
#include <condition_variable>
#include <list>
@@ -359,7 +357,7 @@ std::unique_ptr<PicaTrace> FinishPicaTracing()
}
const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info) {
- assert(info.format == Pica::Regs::TextureFormat::RGB8);
+ _dbg_assert_(GPU, info.format == Pica::Regs::TextureFormat::RGB8);
// Cf. rasterizer code for an explanation of this algorithm.
int texel_index_within_tile = 0;