Introduce a shader tracer to allow inspection of input/output values for each processed instruction.

This commit is contained in:
Tony Wasserka 2015-07-12 01:57:59 +02:00
parent 2e3601f415
commit 33ba604fd9
10 changed files with 601 additions and 97 deletions

View file

@ -10,11 +10,18 @@
#include "nihstro/parser_shbin.h"
#include "video_core/shader/shader.h"
class QLabel;
class QSpinBox;
class GraphicsVertexShaderWidget;
class GraphicsVertexShaderModel : public QAbstractItemModel {
Q_OBJECT
public:
GraphicsVertexShaderModel(QObject* parent);
GraphicsVertexShaderModel(GraphicsVertexShaderWidget* parent);
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
QModelIndex parent(const QModelIndex& child) const override;
@ -23,13 +30,10 @@ public:
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
public slots:
void OnUpdate();
void DumpShader();
private:
nihstro::ShaderInfo info;
GraphicsVertexShaderWidget* par;
friend class GraphicsVertexShaderWidget;
};
class GraphicsVertexShaderWidget : public BreakPointObserverDock {
@ -45,9 +49,41 @@ private slots:
void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override;
void OnResumed() override;
void OnInputAttributeChanged(int index);
void OnIterationIndexChanged(int index);
void DumpShader();
/** Reload widget based on the current PICA200 state
* @param replace_vertex_data If true, invalidate all current vertex data
* @param vertex_data New vertex data to use, as passed to OnBreakPointHit. May be nullptr to specify that no valid vertex data can be retrieved currently. Only used if replace_vertex_data is true.
*/
void Reload(bool replace_vertex_data = false, void* vertex_data = nullptr);
signals:
void Update();
// Call this to change the current command selection in the disassembly view
void SelectCommand(const QModelIndex&, QItemSelectionModel::SelectionFlags);
private:
QLabel* instruction_description;
QTreeView* binary_list;
GraphicsVertexShaderModel* model;
// TODO: Move these into a single struct
std::array<QLineEdit*, 4*16> input_data; // A text box for each of the 4 components of up to 16 vertex attributes
std::array<QWidget*, 16> input_data_container; // QWidget containing the QLayout containing each vertex attribute
std::array<QLabel*, 16> input_data_mapping; // A QLabel denoting the shader input attribute which the vertex attribute maps to
// Text to be shown when input vertex data is not retrievable
QLabel* breakpoint_warning;
QSpinBox* iteration_index;
nihstro::ShaderInfo info;
Pica::Shader::DebugData<true> debug_data;
Pica::Shader::InputVertex input_vertex;
friend class GraphicsVertexShaderModel;
};