summaryrefslogtreecommitdiff
path: root/src/video_core/shader/shader.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/shader/shader.cpp')
-rw-r--r--src/video_core/shader/shader.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp
index 7ae57e619..8dca9d0cb 100644
--- a/src/video_core/shader/shader.cpp
+++ b/src/video_core/shader/shader.cpp
@@ -76,6 +76,17 @@ OutputVertex OutputRegisters::ToVertex(const Regs::ShaderConfig& config) const {
76 return ret; 76 return ret;
77} 77}
78 78
79void UnitState::LoadInputVertex(const InputVertex& input, int num_attributes) {
80 // Setup input register table
81 const auto& attribute_register_map = g_state.regs.vs.input_register_map;
82
83 for (int i = 0; i < num_attributes; i++)
84 registers.input[attribute_register_map.GetRegisterForAttribute(i)] = input.attr[i];
85
86 conditional_code[0] = false;
87 conditional_code[1] = false;
88}
89
79#ifdef ARCHITECTURE_x86_64 90#ifdef ARCHITECTURE_x86_64
80static std::unordered_map<u64, std::unique_ptr<JitShader>> shader_map; 91static std::unordered_map<u64, std::unique_ptr<JitShader>> shader_map;
81static const JitShader* jit_shader; 92static const JitShader* jit_shader;
@@ -109,21 +120,12 @@ void ShaderSetup::Setup() {
109 120
110MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240)); 121MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240));
111 122
112void ShaderSetup::Run(UnitState& state, const InputVertex& input, int num_attributes) { 123void ShaderSetup::Run(UnitState& state) {
113 auto& config = g_state.regs.vs; 124 auto& config = g_state.regs.vs;
114 auto& setup = g_state.vs; 125 auto& setup = g_state.vs;
115 126
116 MICROPROFILE_SCOPE(GPU_Shader); 127 MICROPROFILE_SCOPE(GPU_Shader);
117 128
118 // Setup input register table
119 const auto& attribute_register_map = config.input_register_map;
120
121 for (int i = 0; i < num_attributes; i++)
122 state.registers.input[attribute_register_map.GetRegisterForAttribute(i)] = input.attr[i];
123
124 state.conditional_code[0] = false;
125 state.conditional_code[1] = false;
126
127#ifdef ARCHITECTURE_x86_64 129#ifdef ARCHITECTURE_x86_64
128 if (VideoCore::g_shader_jit_enabled) { 130 if (VideoCore::g_shader_jit_enabled) {
129 jit_shader->Run(setup, state, config.main_offset); 131 jit_shader->Run(setup, state, config.main_offset);
@@ -145,13 +147,7 @@ DebugData<true> ShaderSetup::ProduceDebugInfo(const InputVertex& input, int num_
145 147
146 // Setup input register table 148 // Setup input register table
147 boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero())); 149 boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero()));
148 const auto& attribute_register_map = config.input_register_map; 150 state.LoadInputVertex(input, num_attributes);
149 for (int i = 0; i < num_attributes; i++)
150 state.registers.input[attribute_register_map.GetRegisterForAttribute(i)] = input.attr[i];
151
152 state.conditional_code[0] = false;
153 state.conditional_code[1] = false;
154
155 RunInterpreter(setup, state, debug_data, config.main_offset); 151 RunInterpreter(setup, state, debug_data, config.main_offset);
156 return debug_data; 152 return debug_data;
157} 153}