Sync with master and display command dump.

This commit is contained in:
Vincent Lejeune
2016-08-03 19:04:24 +02:00
committed by vlj
parent 3b11b9652d
commit 7ead63850f
4 changed files with 64 additions and 19 deletions
+35 -16
View File
@@ -6,8 +6,30 @@
#include <cereal/archives/binary.hpp>
#include <Emu/RSX/rsx_trace.h>
#include <algorithm>
//#include <Emu/RSX/Common/BufferUtils.h>
#include <Emu/RSX/gcm_printing.h>
QList<QObject*> load_command_trace()
namespace
{
template<typename T>
void fill_variant_vector(std::vector<gsl::byte> values,
const rsx::frame_capture_data::draw_state &draw_state,
QList<QVariant> &lst)
{
return;
/*
std::vector<gsl::byte> readable_index(values.size());
write_index_array_data_to_buffer(readable_index, values,
draw_state.state.index_type(), rsx::primitive_type::triangles, false, -1, {{0, values.size() / sizeof(T)}},
[](auto) { return false; });
gsl::span<T> casted_readable_index = {reinterpret_cast<T*>(values.data()), gsl::narrow<int>(values.size() / sizeof(T))};
std::for_each(casted_readable_index.begin(), casted_readable_index.end(),
[&lst](auto v) {lst.append(QVariant::fromValue(v));});*/
}
}
std::tuple<QList<QObject*>, QStringList> load_command_trace()
{
// Unfortunatly QTextStream isn't compatible with std::iostream
std::fstream f("../bin/capture.txt", std::ios::in | std::ios::binary);
@@ -24,28 +46,24 @@ QList<QObject*> load_command_trace()
tmp->_name = QString::fromStdString(draw_state.name);
tmp->_transform_program = QString::fromStdString(draw_state.programs.first);
tmp->_shader_program = QString::fromStdString(draw_state.programs.second);
size_t index_list_size = draw_state.index.size();
switch (draw_state.state.index_type())
{
case rsx::index_array_type::u16:
for (size_t i = 0; i < index_list_size / 2; i++)
{
const u16* ptr = reinterpret_cast<const u16*>(draw_state.index.data());
tmp->_index_list.append(QVariant::fromValue(ptr[i]));
}
fill_variant_vector<u16>(draw_state.index, draw_state, tmp->_index_list);
break;
case rsx::index_array_type::u32:
for (size_t i = 0; i < index_list_size / 4; i++)
{
const u32* ptr = reinterpret_cast<const u32*>(draw_state.index.data());
tmp->_index_list.append(QVariant::fromValue(ptr[i]));
}
fill_variant_vector<u32>(draw_state.index, draw_state, tmp->_index_list);
break;
}
st.append(tmp);
}
return st;
QStringList commands;
std::transform(frame_debug.command_queue.begin(), frame_debug.command_queue.end(),
std::back_inserter(commands),
[](const std::pair<u32, u32> pair){ return QString::fromStdString(rsx::get_pretty_printing_function(pair.first)(pair.second));});
return std::make_tuple(st, commands);
}
int main(int argc, char *argv[])
@@ -54,8 +72,9 @@ int main(int argc, char *argv[])
QQmlApplicationEngine engine;
QQmlContext* ctx = engine.rootContext();
QList<QObject*> st = load_command_trace();
ctx->setContextProperty("stateList", QVariant::fromValue(st));
std::tuple<QList<QObject*>, QStringList > st = load_command_trace();
ctx->setContextProperty("commandList", std::get<1>(st));
ctx->setContextProperty("stateList", QVariant::fromValue(std::get<0>(st)));
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+24
View File
@@ -11,6 +11,30 @@ Window {
SplitView {
id: splitView1
anchors.fill: parent
ScrollView
{
ListView {
width: 130
anchors.fill: parent.fill
model: commandList
delegate: Item {
x: 5
width: 80
height: 40
Row {
Text {
text: model.modelData
anchors.verticalCenter: parent.verticalCenter
}
spacing: 10
}
}
}
}
ScrollView
{
ListView {
+5 -2
View File
@@ -5,14 +5,17 @@ CONFIG += c++11
SOURCES += main.cpp \
../rpcs3/Emu/RSX/gcm_enums.cpp \
../Utilities/StrFmt.cpp
../Utilities/StrFmt.cpp \
../rpcs3/Emu/RSX/Common/BufferUtils.cpp \
../rpcs3/Emu/RSX/gcm_printing.cpp
RESOURCES += qml.qrc
INCLUDEPATH += ../ \
../rpcs3/ \
../rsx_program_decompiler/rsx_decompiler/ \
../3rdparty/cereal/include/
../3rdparty/cereal/include/ \
../3rdparty/GSL/include/
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
-1
View File
@@ -5,7 +5,6 @@
#include <Utilities/types.h>
#include <Utilities/StrFmt.h>
#include <Utilities/BEType.h>
#include <Utilities/Macro.h>
#include <Utilities/Atomic.h>
#include <unordered_map>
#include <Emu/RSX/rsx_methods.h>