diff options
| author | 2016-09-21 11:29:48 -0700 | |
|---|---|---|
| committer | 2016-09-21 11:29:48 -0700 | |
| commit | d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a (patch) | |
| tree | 8a22ca73ff838f3f0090b29a548ae81087fc90ed /src/citra_qt/debugger/graphics_tracing.cpp | |
| parent | README: Specify master branch for Travis CI badge (diff) | |
| parent | Fix Travis clang-format check (diff) | |
| download | yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.gz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.tar.xz yuzu-d5d2ca8058a0f1c00ab7ca9fe2c058ba47546c0a.zip | |
Merge pull request #2086 from linkmauve/clang-format
Add clang-format as part of our {commit,travis}-time checks
Diffstat (limited to 'src/citra_qt/debugger/graphics_tracing.cpp')
| -rw-r--r-- | src/citra_qt/debugger/graphics_tracing.cpp | 51 |
1 files changed, 27 insertions, 24 deletions
diff --git a/src/citra_qt/debugger/graphics_tracing.cpp b/src/citra_qt/debugger/graphics_tracing.cpp index 9c80f7ec9..5c6b74034 100644 --- a/src/citra_qt/debugger/graphics_tracing.cpp +++ b/src/citra_qt/debugger/graphics_tracing.cpp | |||
| @@ -6,25 +6,18 @@ | |||
| 6 | #include <array> | 6 | #include <array> |
| 7 | #include <iterator> | 7 | #include <iterator> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | |||
| 10 | #include <boost/range/algorithm/copy.hpp> | ||
| 11 | |||
| 12 | #include <QBoxLayout> | 9 | #include <QBoxLayout> |
| 13 | #include <QComboBox> | 10 | #include <QComboBox> |
| 14 | #include <QFileDialog> | 11 | #include <QFileDialog> |
| 15 | #include <QMessageBox> | 12 | #include <QMessageBox> |
| 16 | #include <QPushButton> | 13 | #include <QPushButton> |
| 17 | 14 | #include <boost/range/algorithm/copy.hpp> | |
| 18 | #include "citra_qt/debugger/graphics_tracing.h" | 15 | #include "citra_qt/debugger/graphics_tracing.h" |
| 19 | |||
| 20 | #include "common/common_types.h" | 16 | #include "common/common_types.h" |
| 21 | |||
| 22 | #include "core/hw/gpu.h" | 17 | #include "core/hw/gpu.h" |
| 23 | #include "core/hw/lcd.h" | 18 | #include "core/hw/lcd.h" |
| 24 | #include "core/tracer/recorder.h" | 19 | #include "core/tracer/recorder.h" |
| 25 | |||
| 26 | #include "nihstro/float24.h" | 20 | #include "nihstro/float24.h" |
| 27 | |||
| 28 | #include "video_core/pica.h" | 21 | #include "video_core/pica.h" |
| 29 | #include "video_core/pica_state.h" | 22 | #include "video_core/pica_state.h" |
| 30 | 23 | ||
| @@ -35,12 +28,16 @@ GraphicsTracingWidget::GraphicsTracingWidget(std::shared_ptr<Pica::DebugContext> | |||
| 35 | setObjectName("CiTracing"); | 28 | setObjectName("CiTracing"); |
| 36 | 29 | ||
| 37 | QPushButton* start_recording = new QPushButton(tr("Start Recording")); | 30 | QPushButton* start_recording = new QPushButton(tr("Start Recording")); |
| 38 | QPushButton* stop_recording = new QPushButton(QIcon::fromTheme("document-save"), tr("Stop and Save")); | 31 | QPushButton* stop_recording = |
| 32 | new QPushButton(QIcon::fromTheme("document-save"), tr("Stop and Save")); | ||
| 39 | QPushButton* abort_recording = new QPushButton(tr("Abort Recording")); | 33 | QPushButton* abort_recording = new QPushButton(tr("Abort Recording")); |
| 40 | 34 | ||
| 41 | connect(this, SIGNAL(SetStartTracingButtonEnabled(bool)), start_recording, SLOT(setVisible(bool))); | 35 | connect(this, SIGNAL(SetStartTracingButtonEnabled(bool)), start_recording, |
| 42 | connect(this, SIGNAL(SetStopTracingButtonEnabled(bool)), stop_recording, SLOT(setVisible(bool))); | 36 | SLOT(setVisible(bool))); |
| 43 | connect(this, SIGNAL(SetAbortTracingButtonEnabled(bool)), abort_recording, SLOT(setVisible(bool))); | 37 | connect(this, SIGNAL(SetStopTracingButtonEnabled(bool)), stop_recording, |
| 38 | SLOT(setVisible(bool))); | ||
| 39 | connect(this, SIGNAL(SetAbortTracingButtonEnabled(bool)), abort_recording, | ||
| 40 | SLOT(setVisible(bool))); | ||
| 44 | connect(start_recording, SIGNAL(clicked()), this, SLOT(StartRecording())); | 41 | connect(start_recording, SIGNAL(clicked()), this, SLOT(StartRecording())); |
| 45 | connect(stop_recording, SIGNAL(clicked()), this, SLOT(StopRecording())); | 42 | connect(stop_recording, SIGNAL(clicked()), this, SLOT(StopRecording())); |
| 46 | connect(abort_recording, SIGNAL(clicked()), this, SLOT(AbortRecording())); | 43 | connect(abort_recording, SIGNAL(clicked()), this, SLOT(AbortRecording())); |
| @@ -74,26 +71,31 @@ void GraphicsTracingWidget::StartRecording() { | |||
| 74 | std::array<u32, 4 * 16> default_attributes; | 71 | std::array<u32, 4 * 16> default_attributes; |
| 75 | for (unsigned i = 0; i < 16; ++i) { | 72 | for (unsigned i = 0; i < 16; ++i) { |
| 76 | for (unsigned comp = 0; comp < 3; ++comp) { | 73 | for (unsigned comp = 0; comp < 3; ++comp) { |
| 77 | default_attributes[4 * i + comp] = nihstro::to_float24(Pica::g_state.vs_default_attributes[i][comp].ToFloat32()); | 74 | default_attributes[4 * i + comp] = |
| 75 | nihstro::to_float24(Pica::g_state.vs_default_attributes[i][comp].ToFloat32()); | ||
| 78 | } | 76 | } |
| 79 | } | 77 | } |
| 80 | 78 | ||
| 81 | std::array<u32, 4 * 96> vs_float_uniforms; | 79 | std::array<u32, 4 * 96> vs_float_uniforms; |
| 82 | for (unsigned i = 0; i < 96; ++i) | 80 | for (unsigned i = 0; i < 96; ++i) |
| 83 | for (unsigned comp = 0; comp < 3; ++comp) | 81 | for (unsigned comp = 0; comp < 3; ++comp) |
| 84 | vs_float_uniforms[4 * i + comp] = nihstro::to_float24(Pica::g_state.vs.uniforms.f[i][comp].ToFloat32()); | 82 | vs_float_uniforms[4 * i + comp] = |
| 83 | nihstro::to_float24(Pica::g_state.vs.uniforms.f[i][comp].ToFloat32()); | ||
| 85 | 84 | ||
| 86 | CiTrace::Recorder::InitialState state; | 85 | CiTrace::Recorder::InitialState state; |
| 87 | std::copy_n((u32*)&GPU::g_regs, sizeof(GPU::g_regs) / sizeof(u32), std::back_inserter(state.gpu_registers)); | 86 | std::copy_n((u32*)&GPU::g_regs, sizeof(GPU::g_regs) / sizeof(u32), |
| 88 | std::copy_n((u32*)&LCD::g_regs, sizeof(LCD::g_regs) / sizeof(u32), std::back_inserter(state.lcd_registers)); | 87 | std::back_inserter(state.gpu_registers)); |
| 89 | std::copy_n((u32*)&Pica::g_state.regs, sizeof(Pica::g_state.regs) / sizeof(u32), std::back_inserter(state.pica_registers)); | 88 | std::copy_n((u32*)&LCD::g_regs, sizeof(LCD::g_regs) / sizeof(u32), |
| 89 | std::back_inserter(state.lcd_registers)); | ||
| 90 | std::copy_n((u32*)&Pica::g_state.regs, sizeof(Pica::g_state.regs) / sizeof(u32), | ||
| 91 | std::back_inserter(state.pica_registers)); | ||
| 90 | boost::copy(default_attributes, std::back_inserter(state.default_attributes)); | 92 | boost::copy(default_attributes, std::back_inserter(state.default_attributes)); |
| 91 | boost::copy(shader_binary, std::back_inserter(state.vs_program_binary)); | 93 | boost::copy(shader_binary, std::back_inserter(state.vs_program_binary)); |
| 92 | boost::copy(swizzle_data, std::back_inserter(state.vs_swizzle_data)); | 94 | boost::copy(swizzle_data, std::back_inserter(state.vs_swizzle_data)); |
| 93 | boost::copy(vs_float_uniforms, std::back_inserter(state.vs_float_uniforms)); | 95 | boost::copy(vs_float_uniforms, std::back_inserter(state.vs_float_uniforms)); |
| 94 | //boost::copy(TODO: Not implemented, std::back_inserter(state.gs_program_binary)); | 96 | // boost::copy(TODO: Not implemented, std::back_inserter(state.gs_program_binary)); |
| 95 | //boost::copy(TODO: Not implemented, std::back_inserter(state.gs_swizzle_data)); | 97 | // boost::copy(TODO: Not implemented, std::back_inserter(state.gs_swizzle_data)); |
| 96 | //boost::copy(TODO: Not implemented, std::back_inserter(state.gs_float_uniforms)); | 98 | // boost::copy(TODO: Not implemented, std::back_inserter(state.gs_float_uniforms)); |
| 97 | 99 | ||
| 98 | auto recorder = new CiTrace::Recorder(state); | 100 | auto recorder = new CiTrace::Recorder(state); |
| 99 | context->recorder = std::shared_ptr<CiTrace::Recorder>(recorder); | 101 | context->recorder = std::shared_ptr<CiTrace::Recorder>(recorder); |
| @@ -156,11 +158,12 @@ void GraphicsTracingWidget::OnEmulationStopping() { | |||
| 156 | if (!context) | 158 | if (!context) |
| 157 | return; | 159 | return; |
| 158 | 160 | ||
| 159 | |||
| 160 | if (context->recorder) { | 161 | if (context->recorder) { |
| 161 | auto reply = QMessageBox::question(this, tr("CiTracing still active"), | 162 | auto reply = |
| 162 | tr("A CiTrace is still being recorded. Do you want to save it? If not, all recorded data will be discarded."), | 163 | QMessageBox::question(this, tr("CiTracing still active"), |
| 163 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); | 164 | tr("A CiTrace is still being recorded. Do you want to save it? " |
| 165 | "If not, all recorded data will be discarded."), | ||
| 166 | QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes); | ||
| 164 | 167 | ||
| 165 | if (reply == QMessageBox::Yes) { | 168 | if (reply == QMessageBox::Yes) { |
| 166 | StopRecording(); | 169 | StopRecording(); |