diff options
| author | 2016-12-11 01:42:43 -0800 | |
|---|---|---|
| committer | 2016-12-11 01:42:43 -0800 | |
| commit | 926e18d25cfb0c493239e743d5b4d762a1c7c208 (patch) | |
| tree | b4da5ba03569093477f90d43f3c071817fd60a31 /src/citra_qt/debugger/graphics_cmdlists.cpp | |
| parent | Core: Add a forgotten #include <cstring> for memcpy. (diff) | |
| parent | graphics_cmdlists: Get rid of variable shadowing (diff) | |
| download | yuzu-926e18d25cfb0c493239e743d5b4d762a1c7c208.tar.gz yuzu-926e18d25cfb0c493239e743d5b4d762a1c7c208.tar.xz yuzu-926e18d25cfb0c493239e743d5b4d762a1c7c208.zip | |
Merge pull request #2300 from lioncash/qt
graphics_cmdlist: Minor changes
Diffstat (limited to 'src/citra_qt/debugger/graphics_cmdlists.cpp')
| -rw-r--r-- | src/citra_qt/debugger/graphics_cmdlists.cpp | 42 |
1 files changed, 24 insertions, 18 deletions
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index 8a784d108..98b619dea 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp | |||
| @@ -21,7 +21,8 @@ | |||
| 21 | #include "video_core/pica.h" | 21 | #include "video_core/pica.h" |
| 22 | #include "video_core/pica_state.h" | 22 | #include "video_core/pica_state.h" |
| 23 | 23 | ||
| 24 | QImage LoadTexture(u8* src, const Pica::DebugUtils::TextureInfo& info) { | 24 | namespace { |
| 25 | QImage LoadTexture(const u8* src, const Pica::DebugUtils::TextureInfo& info) { | ||
| 25 | QImage decoded_image(info.width, info.height, QImage::Format_ARGB32); | 26 | QImage decoded_image(info.width, info.height, QImage::Format_ARGB32); |
| 26 | for (int y = 0; y < info.height; ++y) { | 27 | for (int y = 0; y < info.height; ++y) { |
| 27 | for (int x = 0; x < info.width; ++x) { | 28 | for (int x = 0; x < info.width; ++x) { |
| @@ -35,7 +36,8 @@ QImage LoadTexture(u8* src, const Pica::DebugUtils::TextureInfo& info) { | |||
| 35 | 36 | ||
| 36 | class TextureInfoWidget : public QWidget { | 37 | class TextureInfoWidget : public QWidget { |
| 37 | public: | 38 | public: |
| 38 | TextureInfoWidget(u8* src, const Pica::DebugUtils::TextureInfo& info, QWidget* parent = nullptr) | 39 | TextureInfoWidget(const u8* src, const Pica::DebugUtils::TextureInfo& info, |
| 40 | QWidget* parent = nullptr) | ||
| 39 | : QWidget(parent) { | 41 | : QWidget(parent) { |
| 40 | QLabel* image_widget = new QLabel; | 42 | QLabel* image_widget = new QLabel; |
| 41 | QPixmap image_pixmap = QPixmap::fromImage(LoadTexture(src, info)); | 43 | QPixmap image_pixmap = QPixmap::fromImage(LoadTexture(src, info)); |
| @@ -47,6 +49,7 @@ public: | |||
| 47 | setLayout(layout); | 49 | setLayout(layout); |
| 48 | } | 50 | } |
| 49 | }; | 51 | }; |
| 52 | } // Anonymous namespace | ||
| 50 | 53 | ||
| 51 | GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) {} | 54 | GPUCommandListModel::GPUCommandListModel(QObject* parent) : QAbstractListModel(parent) {} |
| 52 | 55 | ||
| @@ -65,7 +68,6 @@ QVariant GPUCommandListModel::data(const QModelIndex& index, int role) const { | |||
| 65 | const auto& write = pica_trace.writes[index.row()]; | 68 | const auto& write = pica_trace.writes[index.row()]; |
| 66 | 69 | ||
| 67 | if (role == Qt::DisplayRole) { | 70 | if (role == Qt::DisplayRole) { |
| 68 | QString content; | ||
| 69 | switch (index.column()) { | 71 | switch (index.column()) { |
| 70 | case 0: | 72 | case 0: |
| 71 | return QString::fromLatin1(Pica::Regs::GetCommandName(write.cmd_id).c_str()); | 73 | return QString::fromLatin1(Pica::Regs::GetCommandName(write.cmd_id).c_str()); |
| @@ -122,19 +124,21 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { | |||
| 122 | if (COMMAND_IN_RANGE(command_id, texture0) || COMMAND_IN_RANGE(command_id, texture1) || | 124 | if (COMMAND_IN_RANGE(command_id, texture0) || COMMAND_IN_RANGE(command_id, texture1) || |
| 123 | COMMAND_IN_RANGE(command_id, texture2)) { | 125 | COMMAND_IN_RANGE(command_id, texture2)) { |
| 124 | 126 | ||
| 125 | unsigned index; | 127 | unsigned texture_index; |
| 126 | if (COMMAND_IN_RANGE(command_id, texture0)) { | 128 | if (COMMAND_IN_RANGE(command_id, texture0)) { |
| 127 | index = 0; | 129 | texture_index = 0; |
| 128 | } else if (COMMAND_IN_RANGE(command_id, texture1)) { | 130 | } else if (COMMAND_IN_RANGE(command_id, texture1)) { |
| 129 | index = 1; | 131 | texture_index = 1; |
| 130 | } else if (COMMAND_IN_RANGE(command_id, texture2)) { | 132 | } else if (COMMAND_IN_RANGE(command_id, texture2)) { |
| 131 | index = 2; | 133 | texture_index = 2; |
| 132 | } else { | 134 | } else { |
| 133 | UNREACHABLE_MSG("Unknown texture command"); | 135 | UNREACHABLE_MSG("Unknown texture command"); |
| 134 | } | 136 | } |
| 135 | auto config = Pica::g_state.regs.GetTextures()[index].config; | 137 | |
| 136 | auto format = Pica::g_state.regs.GetTextures()[index].format; | 138 | const auto texture = Pica::g_state.regs.GetTextures()[texture_index]; |
| 137 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | 139 | const auto config = texture.config; |
| 140 | const auto format = texture.format; | ||
| 141 | const auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | ||
| 138 | 142 | ||
| 139 | // TODO: Open a surface debugger | 143 | // TODO: Open a surface debugger |
| 140 | } | 144 | } |
| @@ -148,19 +152,21 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | |||
| 148 | if (COMMAND_IN_RANGE(command_id, texture0) || COMMAND_IN_RANGE(command_id, texture1) || | 152 | if (COMMAND_IN_RANGE(command_id, texture0) || COMMAND_IN_RANGE(command_id, texture1) || |
| 149 | COMMAND_IN_RANGE(command_id, texture2)) { | 153 | COMMAND_IN_RANGE(command_id, texture2)) { |
| 150 | 154 | ||
| 151 | unsigned index; | 155 | unsigned texture_index; |
| 152 | if (COMMAND_IN_RANGE(command_id, texture0)) { | 156 | if (COMMAND_IN_RANGE(command_id, texture0)) { |
| 153 | index = 0; | 157 | texture_index = 0; |
| 154 | } else if (COMMAND_IN_RANGE(command_id, texture1)) { | 158 | } else if (COMMAND_IN_RANGE(command_id, texture1)) { |
| 155 | index = 1; | 159 | texture_index = 1; |
| 156 | } else { | 160 | } else { |
| 157 | index = 2; | 161 | texture_index = 2; |
| 158 | } | 162 | } |
| 159 | auto config = Pica::g_state.regs.GetTextures()[index].config; | ||
| 160 | auto format = Pica::g_state.regs.GetTextures()[index].format; | ||
| 161 | 163 | ||
| 162 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | 164 | const auto texture = Pica::g_state.regs.GetTextures()[texture_index]; |
| 163 | u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress()); | 165 | const auto config = texture.config; |
| 166 | const auto format = texture.format; | ||
| 167 | |||
| 168 | const auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | ||
| 169 | const u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress()); | ||
| 164 | new_info_widget = new TextureInfoWidget(src, info); | 170 | new_info_widget = new TextureInfoWidget(src, info); |
| 165 | } | 171 | } |
| 166 | if (command_info_widget) { | 172 | if (command_info_widget) { |