summaryrefslogtreecommitdiff
path: root/src/video_core/shader
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2016-12-18 17:25:03 -0800
committerGravatar Yuri Kunde Schlesner2017-01-29 21:31:37 -0800
commit335df895b9f9e9760ed5cd0d6dfaea8befb94dac (patch)
tree6cd8e76d529d5b4af5f87ef63f617941ced77f3e /src/video_core/shader
parentVideoCore: Use correct register for immediate mode attribute count (diff)
downloadyuzu-335df895b9f9e9760ed5cd0d6dfaea8befb94dac.tar.gz
yuzu-335df895b9f9e9760ed5cd0d6dfaea8befb94dac.tar.xz
yuzu-335df895b9f9e9760ed5cd0d6dfaea8befb94dac.zip
VideoCore: Consistently use shader configuration to load attributes
Diffstat (limited to 'src/video_core/shader')
-rw-r--r--src/video_core/shader/shader.cpp11
-rw-r--r--src/video_core/shader/shader.h6
-rw-r--r--src/video_core/shader/shader_interpreter.cpp4
-rw-r--r--src/video_core/shader/shader_interpreter.h3
4 files changed, 12 insertions, 12 deletions
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp
index 971ce5b7a..dbad167e9 100644
--- a/src/video_core/shader/shader.cpp
+++ b/src/video_core/shader/shader.cpp
@@ -71,12 +71,13 @@ OutputVertex OutputVertex::FromRegisters(Math::Vec4<float24> output_regs[16], co
71 return ret; 71 return ret;
72} 72}
73 73
74void UnitState::LoadInput(const AttributeBuffer& input, int num_attributes) { 74void UnitState::LoadInput(const Regs::ShaderConfig& config, const AttributeBuffer& input) {
75 // Setup input register table 75 const unsigned max_attribute = config.max_input_attribute_index;
76 const auto& attribute_register_map = g_state.regs.vs.input_register_map;
77 76
78 for (int i = 0; i < num_attributes; i++) 77 for (unsigned attr = 0; attr <= max_attribute; ++attr) {
79 registers.input[attribute_register_map.GetRegisterForAttribute(i)] = input.attr[i]; 78 unsigned reg = config.GetRegisterForAttribute(attr);
79 registers.input[reg] = input.attr[attr];
80 }
80} 81}
81 82
82MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240)); 83MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240));
diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h
index cb38ec0a6..43a8b848c 100644
--- a/src/video_core/shader/shader.h
+++ b/src/video_core/shader/shader.h
@@ -137,10 +137,10 @@ struct UnitState {
137 /** 137 /**
138 * Loads the unit state with an input vertex. 138 * Loads the unit state with an input vertex.
139 * 139 *
140 * @param input Input vertex into the shader 140 * @param config Shader configuration registers corresponding to the unit.
141 * @param num_attributes The number of vertex shader attributes to load 141 * @param input Attribute buffer to load into the input registers.
142 */ 142 */
143 void LoadInput(const AttributeBuffer& input, int num_attributes); 143 void LoadInput(const Regs::ShaderConfig& config, const AttributeBuffer& input);
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 d803aebbf..81522b8f5 100644
--- a/src/video_core/shader/shader_interpreter.cpp
+++ b/src/video_core/shader/shader_interpreter.cpp
@@ -669,13 +669,13 @@ void InterpreterEngine::Run(const ShaderSetup& setup, UnitState& state) const {
669 669
670DebugData<true> InterpreterEngine::ProduceDebugInfo(const ShaderSetup& setup, 670DebugData<true> InterpreterEngine::ProduceDebugInfo(const ShaderSetup& setup,
671 const AttributeBuffer& input, 671 const AttributeBuffer& input,
672 int num_attributes) const { 672 const Regs::ShaderConfig& config) 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.LoadInput(input, num_attributes); 678 state.LoadInput(config, input);
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 593e02157..d7a61e122 100644
--- a/src/video_core/shader/shader_interpreter.h
+++ b/src/video_core/shader/shader_interpreter.h
@@ -19,12 +19,11 @@ public:
19 /** 19 /**
20 * Produce debug information based on the given shader and input vertex 20 * Produce debug information based on the given shader and input vertex
21 * @param input Input vertex into the shader 21 * @param input Input vertex into the shader
22 * @param num_attributes The number of vertex shader attributes
23 * @param config Configuration object for the shader pipeline 22 * @param config Configuration object for the shader pipeline
24 * @return Debug information for this shader with regards to the given vertex 23 * @return Debug information for this shader with regards to the given vertex
25 */ 24 */
26 DebugData<true> ProduceDebugInfo(const ShaderSetup& setup, const AttributeBuffer& input, 25 DebugData<true> ProduceDebugInfo(const ShaderSetup& setup, const AttributeBuffer& input,
27 int num_attributes) const; 26 const Regs::ShaderConfig& config) const;
28}; 27};
29 28
30} // namespace 29} // namespace