2014-12-10 18:24:56 +00:00
|
|
|
// Copyright 2014 Citra Emulator Project
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2015-08-19 09:51:12 +01:00
|
|
|
#include <QAbstractTableModel>
|
2016-09-20 16:21:23 +01:00
|
|
|
#include <QTreeView>
|
2015-09-11 05:23:00 +01:00
|
|
|
#include "citra_qt/debugger/graphics_breakpoint_observer.h"
|
2014-12-10 18:24:56 +00:00
|
|
|
#include "nihstro/parser_shbin.h"
|
2015-07-12 00:57:59 +01:00
|
|
|
#include "video_core/shader/shader.h"
|
|
|
|
|
|
|
|
class QLabel;
|
|
|
|
class QSpinBox;
|
|
|
|
|
|
|
|
class GraphicsVertexShaderWidget;
|
|
|
|
|
2015-08-19 09:51:12 +01:00
|
|
|
class GraphicsVertexShaderModel : public QAbstractTableModel {
|
2014-12-10 18:24:56 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-07-12 00:57:59 +01:00
|
|
|
GraphicsVertexShaderModel(GraphicsVertexShaderWidget* parent);
|
2014-12-10 18:24:56 +00:00
|
|
|
|
|
|
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
|
|
|
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
|
2016-09-18 01:38:01 +01:00
|
|
|
QVariant headerData(int section, Qt::Orientation orientation,
|
|
|
|
int role = Qt::DisplayRole) const override;
|
2014-12-10 18:24:56 +00:00
|
|
|
|
|
|
|
private:
|
2015-07-12 00:57:59 +01:00
|
|
|
GraphicsVertexShaderWidget* par;
|
|
|
|
|
|
|
|
friend class GraphicsVertexShaderWidget;
|
2014-12-10 18:24:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class GraphicsVertexShaderWidget : public BreakPointObserverDock {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
using Event = Pica::DebugContext::Event;
|
|
|
|
|
|
|
|
public:
|
|
|
|
GraphicsVertexShaderWidget(std::shared_ptr<Pica::DebugContext> debug_context,
|
|
|
|
QWidget* parent = nullptr);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void OnBreakPointHit(Pica::DebugContext::Event event, void* data) override;
|
|
|
|
void OnResumed() override;
|
|
|
|
|
2015-07-12 00:57:59 +01:00
|
|
|
void OnInputAttributeChanged(int index);
|
|
|
|
|
2015-08-15 19:13:48 +01:00
|
|
|
void OnCycleIndexChanged(int index);
|
2015-07-12 00:57:59 +01:00
|
|
|
|
|
|
|
void DumpShader();
|
|
|
|
|
2015-08-15 18:55:26 +01:00
|
|
|
/**
|
|
|
|
* Reload widget based on the current PICA200 state
|
|
|
|
* @param replace_vertex_data If true, invalidate all current vertex data
|
2016-09-18 01:38:01 +01:00
|
|
|
* @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.
|
2015-08-15 18:55:26 +01:00
|
|
|
*/
|
2015-07-12 00:57:59 +01:00
|
|
|
void Reload(bool replace_vertex_data = false, void* vertex_data = nullptr);
|
|
|
|
|
2014-12-10 18:24:56 +00:00
|
|
|
private:
|
2015-07-12 00:57:59 +01:00
|
|
|
QLabel* instruction_description;
|
|
|
|
QTreeView* binary_list;
|
|
|
|
GraphicsVertexShaderModel* model;
|
|
|
|
|
2015-08-15 18:55:26 +01:00
|
|
|
/// TODO: Move these into a single struct
|
2016-09-18 01:38:01 +01:00
|
|
|
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
|
2015-07-12 00:57:59 +01:00
|
|
|
|
|
|
|
// Text to be shown when input vertex data is not retrievable
|
|
|
|
QLabel* breakpoint_warning;
|
|
|
|
|
2015-08-15 19:13:48 +01:00
|
|
|
QSpinBox* cycle_index;
|
2015-07-12 00:57:59 +01:00
|
|
|
|
|
|
|
nihstro::ShaderInfo info;
|
|
|
|
Pica::Shader::DebugData<true> debug_data;
|
|
|
|
Pica::Shader::InputVertex input_vertex;
|
2014-12-10 18:24:56 +00:00
|
|
|
|
2015-07-12 00:57:59 +01:00
|
|
|
friend class GraphicsVertexShaderModel;
|
2014-12-10 18:24:56 +00:00
|
|
|
};
|