summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2016-12-18 16:42:19 -0800
committerGravatar Yuri Kunde Schlesner2017-01-29 21:31:36 -0800
commitab6954e942654fb003964fc95c0846aa8b89ac91 (patch)
tree5bcd962d8a38044f71967f41ba9cab70a942e2f0 /src
parentVideoCore: Change misleading register names (diff)
downloadyuzu-ab6954e942654fb003964fc95c0846aa8b89ac91.tar.gz
yuzu-ab6954e942654fb003964fc95c0846aa8b89ac91.tar.xz
yuzu-ab6954e942654fb003964fc95c0846aa8b89ac91.zip
VideoCore: Rename some types to more accurate names
Diffstat (limited to 'src')
-rw-r--r--src/citra_qt/debugger/graphics/graphics_tracing.cpp4
-rw-r--r--src/citra_qt/debugger/graphics/graphics_vertex_shader.h2
-rw-r--r--src/video_core/command_processor.cpp11
-rw-r--r--src/video_core/pica_state.h4
-rw-r--r--src/video_core/shader/shader.cpp2
-rw-r--r--src/video_core/shader/shader.h4
-rw-r--r--src/video_core/shader/shader_interpreter.cpp4
-rw-r--r--src/video_core/shader/shader_interpreter.h2
-rw-r--r--src/video_core/vertex_loader.cpp5
-rw-r--r--src/video_core/vertex_loader.h4
10 files changed, 21 insertions, 21 deletions
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() {
71 std::array<u32, 4 * 16> default_attributes; 71 std::array<u32, 4 * 16> default_attributes;
72 for (unsigned i = 0; i < 16; ++i) { 72 for (unsigned i = 0; i < 16; ++i) {
73 for (unsigned comp = 0; comp < 3; ++comp) { 73 for (unsigned comp = 0; comp < 3; ++comp) {
74 default_attributes[4 * i + comp] = 74 default_attributes[4 * i + comp] = nihstro::to_float24(
75 nihstro::to_float24(Pica::g_state.vs_default_attributes[i][comp].ToFloat32()); 75 Pica::g_state.input_default_attributes.attr[i][comp].ToFloat32());
76 } 76 }
77 } 77 }
78 78
diff --git a/src/citra_qt/debugger/graphics/graphics_vertex_shader.h b/src/citra_qt/debugger/graphics/graphics_vertex_shader.h
index 3292573f3..c249a2ff8 100644
--- a/src/citra_qt/debugger/graphics/graphics_vertex_shader.h
+++ b/src/citra_qt/debugger/graphics/graphics_vertex_shader.h
@@ -82,7 +82,7 @@ private:
82 82
83 nihstro::ShaderInfo info; 83 nihstro::ShaderInfo info;
84 Pica::Shader::DebugData<true> debug_data; 84 Pica::Shader::DebugData<true> debug_data;
85 Pica::Shader::InputVertex input_vertex; 85 Pica::Shader::AttributeBuffer input_vertex;
86 86
87 friend class GraphicsVertexShaderModel; 87 friend class GraphicsVertexShaderModel;
88}; 88};
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 9c0ed79c7..45b994b46 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -125,7 +125,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
125 125
126 // TODO: Verify that this actually modifies the register! 126 // TODO: Verify that this actually modifies the register!
127 if (setup.index < 15) { 127 if (setup.index < 15) {
128 g_state.vs_default_attributes[setup.index] = attribute; 128 g_state.input_default_attributes.attr[setup.index] = attribute;
129 setup.index++; 129 setup.index++;
130 } else { 130 } else {
131 // Put each attribute into an immediate input buffer. 131 // Put each attribute into an immediate input buffer.
@@ -138,7 +138,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
138 138
139 immediate_input.attr[immediate_attribute_id++] = attribute; 139 immediate_input.attr[immediate_attribute_id++] = attribute;
140 140
141 if (immediate_attribute_id >= regs.vs.max_input_attribute_index + 1) { 141 if (immediate_attribute_id > regs.vs.max_input_attribute_index) {
142 MICROPROFILE_SCOPE(GPU_Drawing); 142 MICROPROFILE_SCOPE(GPU_Drawing);
143 immediate_attribute_id = 0; 143 immediate_attribute_id = 0;
144 144
@@ -150,8 +150,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
150 g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, 150 g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation,
151 static_cast<void*>(&immediate_input)); 151 static_cast<void*>(&immediate_input));
152 Shader::UnitState shader_unit; 152 Shader::UnitState shader_unit;
153 shader_unit.LoadInputVertex(immediate_input, 153 shader_unit.LoadInput(immediate_input, regs.vs.max_input_attribute_index + 1);
154 regs.vs.max_input_attribute_index + 1);
155 shader_engine->Run(g_state.vs, shader_unit); 154 shader_engine->Run(g_state.vs, shader_unit);
156 auto output_vertex = Shader::OutputVertex::FromRegisters( 155 auto output_vertex = Shader::OutputVertex::FromRegisters(
157 shader_unit.registers.output, regs, regs.vs.output_mask); 156 shader_unit.registers.output, regs, regs.vs.output_mask);
@@ -281,14 +280,14 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) {
281 280
282 if (!vertex_cache_hit) { 281 if (!vertex_cache_hit) {
283 // Initialize data for the current vertex 282 // Initialize data for the current vertex
284 Shader::InputVertex input; 283 Shader::AttributeBuffer input;
285 loader.LoadVertex(base_address, index, vertex, input, memory_accesses); 284 loader.LoadVertex(base_address, index, vertex, input, memory_accesses);
286 285
287 // Send to vertex shader 286 // Send to vertex shader
288 if (g_debug_context) 287 if (g_debug_context)
289 g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, 288 g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation,
290 (void*)&input); 289 (void*)&input);
291 shader_unit.LoadInputVertex(input, loader.GetNumTotalAttributes()); 290 shader_unit.LoadInput(input, loader.GetNumTotalAttributes());
292 shader_engine->Run(g_state.vs, shader_unit); 291 shader_engine->Run(g_state.vs, shader_unit);
293 292
294 // Retrieve vertex from register data 293 // Retrieve vertex from register data
diff --git a/src/video_core/pica_state.h b/src/video_core/pica_state.h
index e4f2e6d5d..785d05650 100644
--- a/src/video_core/pica_state.h
+++ b/src/video_core/pica_state.h
@@ -23,7 +23,7 @@ struct State {
23 Shader::ShaderSetup vs; 23 Shader::ShaderSetup vs;
24 Shader::ShaderSetup gs; 24 Shader::ShaderSetup gs;
25 25
26 std::array<Math::Vec4<float24>, 16> vs_default_attributes; 26 Shader::AttributeBuffer input_default_attributes;
27 27
28 struct { 28 struct {
29 union LutEntry { 29 union LutEntry {
@@ -66,7 +66,7 @@ struct State {
66 /// Struct used to describe immediate mode rendering state 66 /// Struct used to describe immediate mode rendering state
67 struct ImmediateModeState { 67 struct ImmediateModeState {
68 // Used to buffer partial vertices for immediate-mode rendering. 68 // Used to buffer partial vertices for immediate-mode rendering.
69 Shader::InputVertex input_vertex; 69 Shader::AttributeBuffer input_vertex;
70 // Index of the next attribute to be loaded into `input_vertex`. 70 // Index of the next attribute to be loaded into `input_vertex`.
71 u32 current_attribute = 0; 71 u32 current_attribute = 0;
72 } immediate; 72 } immediate;
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp
index 2da50bd62..971ce5b7a 100644
--- a/src/video_core/shader/shader.cpp
+++ b/src/video_core/shader/shader.cpp
@@ -71,7 +71,7 @@ OutputVertex OutputVertex::FromRegisters(Math::Vec4<float24> output_regs[16], co
71 return ret; 71 return ret;
72} 72}
73 73
74void UnitState::LoadInputVertex(const InputVertex& input, int num_attributes) { 74void UnitState::LoadInput(const AttributeBuffer& input, int num_attributes) {
75 // Setup input register table 75 // Setup input register table
76 const auto& attribute_register_map = g_state.regs.vs.input_register_map; 76 const auto& attribute_register_map = g_state.regs.vs.input_register_map;
77 77
diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h
index 44d9f76c3..cb38ec0a6 100644
--- a/src/video_core/shader/shader.h
+++ b/src/video_core/shader/shader.h
@@ -23,7 +23,7 @@ namespace Pica {
23 23
24namespace Shader { 24namespace Shader {
25 25
26struct InputVertex { 26struct AttributeBuffer {
27 alignas(16) Math::Vec4<float24> attr[16]; 27 alignas(16) Math::Vec4<float24> attr[16];
28}; 28};
29 29
@@ -140,7 +140,7 @@ struct UnitState {
140 * @param input Input vertex into the shader 140 * @param input Input vertex into the shader
141 * @param num_attributes The number of vertex shader attributes to load 141 * @param num_attributes The number of vertex shader attributes to load
142 */ 142 */
143 void LoadInputVertex(const InputVertex& input, int num_attributes); 143 void LoadInput(const AttributeBuffer& input, int num_attributes);
144}; 144};
145 145
146struct ShaderSetup { 146struct ShaderSetup {
diff --git a/src/video_core/shader/shader_interpreter.cpp b/src/video_core/shader/shader_interpreter.cpp
index c0c89b857..d803aebbf 100644
--- a/src/video_core/shader/shader_interpreter.cpp
+++ b/src/video_core/shader/shader_interpreter.cpp
@@ -668,14 +668,14 @@ void InterpreterEngine::Run(const ShaderSetup& setup, UnitState& state) const {
668} 668}
669 669
670DebugData<true> InterpreterEngine::ProduceDebugInfo(const ShaderSetup& setup, 670DebugData<true> InterpreterEngine::ProduceDebugInfo(const ShaderSetup& setup,
671 const InputVertex& input, 671 const AttributeBuffer& input,
672 int num_attributes) const { 672 int num_attributes) const {
673 UnitState state; 673 UnitState state;
674 DebugData<true> debug_data; 674 DebugData<true> debug_data;
675 675
676 // Setup input register table 676 // Setup input register table
677 boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero())); 677 boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero()));
678 state.LoadInputVertex(input, num_attributes); 678 state.LoadInput(input, num_attributes);
679 RunInterpreter(setup, state, debug_data, setup.engine_data.entry_point); 679 RunInterpreter(setup, state, debug_data, setup.engine_data.entry_point);
680 return debug_data; 680 return debug_data;
681} 681}
diff --git a/src/video_core/shader/shader_interpreter.h b/src/video_core/shader/shader_interpreter.h
index d6c0e2d8c..593e02157 100644
--- a/src/video_core/shader/shader_interpreter.h
+++ b/src/video_core/shader/shader_interpreter.h
@@ -23,7 +23,7 @@ public:
23 * @param config Configuration object for the shader pipeline 23 * @param config Configuration object for the shader pipeline
24 * @return Debug information for this shader with regards to the given vertex 24 * @return Debug information for this shader with regards to the given vertex
25 */ 25 */
26 DebugData<true> ProduceDebugInfo(const ShaderSetup& setup, const InputVertex& input, 26 DebugData<true> ProduceDebugInfo(const ShaderSetup& setup, const AttributeBuffer& input,
27 int num_attributes) const; 27 int num_attributes) const;
28}; 28};
29 29
diff --git a/src/video_core/vertex_loader.cpp b/src/video_core/vertex_loader.cpp
index 2b8ef7018..bf83b61ca 100644
--- a/src/video_core/vertex_loader.cpp
+++ b/src/video_core/vertex_loader.cpp
@@ -70,7 +70,8 @@ void VertexLoader::Setup(const Pica::Regs& regs) {
70 is_setup = true; 70 is_setup = true;
71} 71}
72 72
73void VertexLoader::LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, 73void VertexLoader::LoadVertex(u32 base_address, int index, int vertex,
74 Shader::AttributeBuffer& input,
74 DebugUtils::MemoryAccessTracker& memory_accesses) { 75 DebugUtils::MemoryAccessTracker& memory_accesses) {
75 ASSERT_MSG(is_setup, "A VertexLoader needs to be setup before loading vertices."); 76 ASSERT_MSG(is_setup, "A VertexLoader needs to be setup before loading vertices.");
76 77
@@ -142,7 +143,7 @@ void VertexLoader::LoadVertex(u32 base_address, int index, int vertex, Shader::I
142 input.attr[i][2].ToFloat32(), input.attr[i][3].ToFloat32()); 143 input.attr[i][2].ToFloat32(), input.attr[i][3].ToFloat32());
143 } else if (vertex_attribute_is_default[i]) { 144 } else if (vertex_attribute_is_default[i]) {
144 // Load the default attribute if we're configured to do so 145 // Load the default attribute if we're configured to do so
145 input.attr[i] = g_state.vs_default_attributes[i]; 146 input.attr[i] = g_state.input_default_attributes.attr[i];
146 LOG_TRACE(HW_GPU, 147 LOG_TRACE(HW_GPU,
147 "Loaded default attribute %x for vertex %x (index %x): (%f, %f, %f, %f)", i, 148 "Loaded default attribute %x for vertex %x (index %x): (%f, %f, %f, %f)", i,
148 vertex, index, input.attr[i][0].ToFloat32(), input.attr[i][1].ToFloat32(), 149 vertex, index, input.attr[i][0].ToFloat32(), input.attr[i][1].ToFloat32(),
diff --git a/src/video_core/vertex_loader.h b/src/video_core/vertex_loader.h
index 9f2098bb2..51f3d45b4 100644
--- a/src/video_core/vertex_loader.h
+++ b/src/video_core/vertex_loader.h
@@ -11,7 +11,7 @@ class MemoryAccessTracker;
11} 11}
12 12
13namespace Shader { 13namespace Shader {
14struct InputVertex; 14struct AttributeBuffer;
15} 15}
16 16
17class VertexLoader { 17class VertexLoader {
@@ -22,7 +22,7 @@ public:
22 } 22 }
23 23
24 void Setup(const Pica::Regs& regs); 24 void Setup(const Pica::Regs& regs);
25 void LoadVertex(u32 base_address, int index, int vertex, Shader::InputVertex& input, 25 void LoadVertex(u32 base_address, int index, int vertex, Shader::AttributeBuffer& input,
26 DebugUtils::MemoryAccessTracker& memory_accesses); 26 DebugUtils::MemoryAccessTracker& memory_accesses);
27 27
28 int GetNumTotalAttributes() const { 28 int GetNumTotalAttributes() const {