summaryrefslogtreecommitdiff
path: root/src/citra_qt/debugger
diff options
context:
space:
mode:
Diffstat (limited to 'src/citra_qt/debugger')
-rw-r--r--src/citra_qt/debugger/callstack.cpp1
-rw-r--r--src/citra_qt/debugger/graphics/graphics_cmdlists.cpp15
-rw-r--r--src/citra_qt/debugger/graphics/graphics_surface.cpp20
-rw-r--r--src/citra_qt/debugger/graphics/graphics_tracing.cpp4
-rw-r--r--src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp15
-rw-r--r--src/citra_qt/debugger/graphics/graphics_vertex_shader.h3
-rw-r--r--src/citra_qt/debugger/ramview.cpp12
-rw-r--r--src/citra_qt/debugger/ramview.h17
-rw-r--r--src/citra_qt/debugger/wait_tree.cpp9
9 files changed, 33 insertions, 63 deletions
diff --git a/src/citra_qt/debugger/callstack.cpp b/src/citra_qt/debugger/callstack.cpp
index c1db93583..08d2e7a22 100644
--- a/src/citra_qt/debugger/callstack.cpp
+++ b/src/citra_qt/debugger/callstack.cpp
@@ -45,7 +45,6 @@ void CallstackWidget::OnDebugModeEntered() {
if (ARM_Disasm::Decode(insn) == OP_BL) {
std::string name;
// ripped from disasm
- u8 cond = (insn >> 28) & 0xf;
u32 i_offset = insn & 0xffffff;
// Sign-extend the 24-bit offset
if ((i_offset >> 23) & 1)
diff --git a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
index dab529e3a..ee79f0edf 100644
--- a/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_cmdlists.cpp
@@ -20,13 +20,14 @@
#include "video_core/debug_utils/debug_utils.h"
#include "video_core/pica.h"
#include "video_core/pica_state.h"
+#include "video_core/texture/texture_decode.h"
namespace {
-QImage LoadTexture(const u8* src, const Pica::DebugUtils::TextureInfo& info) {
+QImage LoadTexture(const u8* src, const Pica::Texture::TextureInfo& info) {
QImage decoded_image(info.width, info.height, QImage::Format_ARGB32);
for (int y = 0; y < info.height; ++y) {
for (int x = 0; x < info.width; ++x) {
- Math::Vec4<u8> color = Pica::DebugUtils::LookupTexture(src, x, y, info, true);
+ Math::Vec4<u8> color = Pica::Texture::LookupTexture(src, x, y, info, true);
decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a()));
}
}
@@ -36,9 +37,10 @@ QImage LoadTexture(const u8* src, const Pica::DebugUtils::TextureInfo& info) {
class TextureInfoWidget : public QWidget {
public:
- TextureInfoWidget(const u8* src, const Pica::DebugUtils::TextureInfo& info,
+ TextureInfoWidget(const u8* src, const Pica::Texture::TextureInfo& info,
QWidget* parent = nullptr)
: QWidget(parent) {
+
QLabel* image_widget = new QLabel;
QPixmap image_pixmap = QPixmap::fromImage(LoadTexture(src, info));
image_pixmap = image_pixmap.scaled(200, 100, Qt::KeepAspectRatio, Qt::SmoothTransformation);
@@ -135,11 +137,6 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) {
UNREACHABLE_MSG("Unknown texture command");
}
- const auto texture = Pica::g_state.regs.GetTextures()[texture_index];
- const auto config = texture.config;
- const auto format = texture.format;
- const auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
-
// TODO: Open a surface debugger
}
}
@@ -165,7 +162,7 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) {
const auto config = texture.config;
const auto format = texture.format;
- const auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format);
+ const auto info = Pica::Texture::TextureInfo::FromPicaRegister(config, format);
const u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress());
new_info_widget = new TextureInfoWidget(src, info);
}
diff --git a/src/citra_qt/debugger/graphics/graphics_surface.cpp b/src/citra_qt/debugger/graphics/graphics_surface.cpp
index 4efd95d3c..bd82b00d4 100644
--- a/src/citra_qt/debugger/graphics/graphics_surface.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_surface.cpp
@@ -18,6 +18,7 @@
#include "core/memory.h"
#include "video_core/pica.h"
#include "video_core/pica_state.h"
+#include "video_core/texture/texture_decode.h"
#include "video_core/utils.h"
SurfacePicture::SurfacePicture(QWidget* parent, GraphicsSurfaceWidget* surface_widget_)
@@ -512,7 +513,7 @@ void GraphicsSurfaceWidget::OnUpdate() {
}
const auto texture = Pica::g_state.regs.GetTextures()[texture_index];
- auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(texture.config, texture.format);
+ auto info = Pica::Texture::TextureInfo::FromPicaRegister(texture.config, texture.format);
surface_address = info.physical_address;
surface_width = info.width;
@@ -567,28 +568,27 @@ void GraphicsSurfaceWidget::OnUpdate() {
surface_picture_label->show();
- unsigned nibbles_per_pixel = GraphicsSurfaceWidget::NibblesPerPixel(surface_format);
- unsigned stride = nibbles_per_pixel * surface_width / 2;
-
- // We handle depth formats here because DebugUtils only supports TextureFormats
if (surface_format <= Format::MaxTextureFormat) {
-
// Generate a virtual texture
- Pica::DebugUtils::TextureInfo info;
+ Pica::Texture::TextureInfo info;
info.physical_address = surface_address;
info.width = surface_width;
info.height = surface_height;
info.format = static_cast<Pica::Regs::TextureFormat>(surface_format);
- info.stride = stride;
+ info.SetDefaultStride();
for (unsigned int y = 0; y < surface_height; ++y) {
for (unsigned int x = 0; x < surface_width; ++x) {
- Math::Vec4<u8> color = Pica::DebugUtils::LookupTexture(buffer, x, y, info, true);
+ Math::Vec4<u8> color = Pica::Texture::LookupTexture(buffer, x, y, info, true);
decoded_image.setPixel(x, y, qRgba(color.r(), color.g(), color.b(), color.a()));
}
}
-
} else {
+ // We handle depth formats here because DebugUtils only supports TextureFormats
+
+ // TODO(yuriks): Convert to newer tile-based addressing
+ unsigned nibbles_per_pixel = GraphicsSurfaceWidget::NibblesPerPixel(surface_format);
+ unsigned stride = nibbles_per_pixel * surface_width / 2;
ASSERT_MSG(nibbles_per_pixel >= 2,
"Depth decoder only supports formats with at least one byte per pixel");
diff --git a/src/citra_qt/debugger/graphics/graphics_tracing.cpp b/src/citra_qt/debugger/graphics/graphics_tracing.cpp
index 716ed50b8..17f1c5ce2 100644
--- a/src/citra_qt/debugger/graphics/graphics_tracing.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_tracing.cpp
@@ -71,8 +71,8 @@ void GraphicsTracingWidget::StartRecording() {
std::array<u32, 4 * 16> default_attributes;
for (unsigned i = 0; i < 16; ++i) {
for (unsigned comp = 0; comp < 3; ++comp) {
- default_attributes[4 * i + comp] =
- nihstro::to_float24(Pica::g_state.vs_default_attributes[i][comp].ToFloat32());
+ default_attributes[4 * i + comp] = nihstro::to_float24(
+ Pica::g_state.input_default_attributes.attr[i][comp].ToFloat32());
}
}
diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp
index b75b94ef8..489ec5f21 100644
--- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp
+++ b/src/citra_qt/debugger/graphics/graphics_vertex_shader.cpp
@@ -18,7 +18,9 @@
#include "citra_qt/util/util.h"
#include "video_core/pica.h"
#include "video_core/pica_state.h"
+#include "video_core/shader/debug_data.h"
#include "video_core/shader/shader.h"
+#include "video_core/shader/shader_interpreter.h"
using nihstro::OpCode;
using nihstro::Instruction;
@@ -276,9 +278,6 @@ QVariant GraphicsVertexShaderModel::data(const QModelIndex& index, int role) con
output << 'b' << instr.flow_control.bool_uniform_id << ' ';
}
- u32 target_addr = instr.flow_control.dest_offset;
- u32 target_addr_else = instr.flow_control.dest_offset;
-
if (opcode_info.subtype & OpCode::Info::HasAlternative) {
output << "else jump to 0x" << std::setw(4) << std::right
<< std::setfill('0') << std::hex
@@ -473,7 +472,6 @@ GraphicsVertexShaderWidget::GraphicsVertexShaderWidget(
}
void GraphicsVertexShaderWidget::OnBreakPointHit(Pica::DebugContext::Event event, void* data) {
- auto input = static_cast<Pica::Shader::InputVertex*>(data);
if (event == Pica::DebugContext::Event::VertexShaderInvocation) {
Reload(true, data);
} else {
@@ -513,7 +511,7 @@ void GraphicsVertexShaderWidget::Reload(bool replace_vertex_data, void* vertex_d
auto& shader_config = Pica::g_state.regs.vs;
for (auto instr : shader_setup.program_code)
info.code.push_back({instr});
- int num_attributes = Pica::g_state.regs.vertex_attributes.GetNumTotalAttributes();
+ int num_attributes = shader_config.max_input_attribute_index + 1;
for (auto pattern : shader_setup.swizzle_data)
info.swizzle_info.push_back({pattern});
@@ -522,12 +520,13 @@ void GraphicsVertexShaderWidget::Reload(bool replace_vertex_data, void* vertex_d
info.labels.insert({entry_point, "main"});
// Generate debug information
- debug_data = Pica::g_state.vs.ProduceDebugInfo(input_vertex, num_attributes, shader_config,
- shader_setup);
+ Pica::Shader::InterpreterEngine shader_engine;
+ shader_engine.SetupBatch(shader_setup, entry_point);
+ debug_data = shader_engine.ProduceDebugInfo(shader_setup, input_vertex, shader_config);
// Reload widget state
for (int attr = 0; attr < num_attributes; ++attr) {
- unsigned source_attr = shader_config.input_register_map.GetRegisterForAttribute(attr);
+ unsigned source_attr = shader_config.GetRegisterForAttribute(attr);
input_data_mapping[attr]->setText(QString("-> v%1").arg(source_attr));
input_data_container[attr]->setVisible(true);
}
diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.h b/src/citra_qt/debugger/graphics/graphics_vertex_shader.h
index bedea0bed..c249a2ff8 100644
--- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.h
+++ b/src/citra_qt/debugger/graphics/graphics_vertex_shader.h
@@ -8,6 +8,7 @@
#include <QTreeView>
#include "citra_qt/debugger/graphics/graphics_breakpoint_observer.h"
#include "nihstro/parser_shbin.h"
+#include "video_core/shader/debug_data.h"
#include "video_core/shader/shader.h"
class QLabel;
@@ -81,7 +82,7 @@ private:
nihstro::ShaderInfo info;
Pica::Shader::DebugData<true> debug_data;
- Pica::Shader::InputVertex input_vertex;
+ Pica::Shader::AttributeBuffer input_vertex;
friend class GraphicsVertexShaderModel;
};
diff --git a/src/citra_qt/debugger/ramview.cpp b/src/citra_qt/debugger/ramview.cpp
deleted file mode 100644
index 10a09dda8..000000000
--- a/src/citra_qt/debugger/ramview.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#include "citra_qt/debugger/ramview.h"
-
-GRamView::GRamView(QWidget* parent) : QHexEdit(parent) {}
-
-void GRamView::OnCPUStepped() {
- // TODO: QHexEdit doesn't show vertical scroll bars for > 10MB data streams...
- // setData(QByteArray((const char*)Mem_RAM,sizeof(Mem_RAM)/8));
-}
diff --git a/src/citra_qt/debugger/ramview.h b/src/citra_qt/debugger/ramview.h
deleted file mode 100644
index d01cea93b..000000000
--- a/src/citra_qt/debugger/ramview.h
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright 2014 Citra Emulator Project
-// Licensed under GPLv2 or any later version
-// Refer to the license.txt file included.
-
-#pragma once
-
-#include "qhexedit.h"
-
-class GRamView : public QHexEdit {
- Q_OBJECT
-
-public:
- explicit GRamView(QWidget* parent = nullptr);
-
-public slots:
- void OnCPUStepped();
-};
diff --git a/src/citra_qt/debugger/wait_tree.cpp b/src/citra_qt/debugger/wait_tree.cpp
index 1d2de5185..b6ecf3819 100644
--- a/src/citra_qt/debugger/wait_tree.cpp
+++ b/src/citra_qt/debugger/wait_tree.cpp
@@ -153,7 +153,8 @@ QString WaitTreeThread::GetText() const {
case THREADSTATUS_WAIT_SLEEP:
status = tr("sleeping");
break;
- case THREADSTATUS_WAIT_SYNCH:
+ case THREADSTATUS_WAIT_SYNCH_ALL:
+ case THREADSTATUS_WAIT_SYNCH_ANY:
status = tr("waiting for objects");
break;
case THREADSTATUS_DORMANT:
@@ -180,7 +181,8 @@ QColor WaitTreeThread::GetColor() const {
return QColor(Qt::GlobalColor::darkRed);
case THREADSTATUS_WAIT_SLEEP:
return QColor(Qt::GlobalColor::darkYellow);
- case THREADSTATUS_WAIT_SYNCH:
+ case THREADSTATUS_WAIT_SYNCH_ALL:
+ case THREADSTATUS_WAIT_SYNCH_ANY:
return QColor(Qt::GlobalColor::red);
case THREADSTATUS_DORMANT:
return QColor(Qt::GlobalColor::darkCyan);
@@ -228,7 +230,8 @@ std::vector<std::unique_ptr<WaitTreeItem>> WaitTreeThread::GetChildren() const {
} else {
list.push_back(std::make_unique<WaitTreeMutexList>(thread.held_mutexes));
}
- if (thread.status == THREADSTATUS_WAIT_SYNCH) {
+ if (thread.status == THREADSTATUS_WAIT_SYNCH_ANY ||
+ thread.status == THREADSTATUS_WAIT_SYNCH_ALL) {
list.push_back(std::make_unique<WaitTreeObjectList>(thread.wait_objects,
thread.IsSleepingOnWaitAll()));
}