summaryrefslogtreecommitdiff
path: root/src/video_core
diff options
context:
space:
mode:
authorGravatar Yuri Kunde Schlesner2016-12-16 21:48:36 -0800
committerGravatar Yuri Kunde Schlesner2017-01-25 18:53:23 -0800
commite3caf669b05bc0727053885ee7e6e5c78d655df4 (patch)
treeb1a9ef206e1a27664f5f1600f3d45a34a077edb2 /src/video_core
parentVideoCore/Shader: Extract input vertex loading code into function (diff)
downloadyuzu-e3caf669b05bc0727053885ee7e6e5c78d655df4.tar.gz
yuzu-e3caf669b05bc0727053885ee7e6e5c78d655df4.tar.xz
yuzu-e3caf669b05bc0727053885ee7e6e5c78d655df4.zip
VideoCore/Shader: Use self instead of g_state.vs in ShaderSetup
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/shader/shader.cpp16
-rw-r--r--src/video_core/shader/shader.h3
2 files changed, 8 insertions, 11 deletions
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp
index 8dca9d0cb..868be1360 100644
--- a/src/video_core/shader/shader.cpp
+++ b/src/video_core/shader/shader.cpp
@@ -102,8 +102,8 @@ void ShaderSetup::Setup() {
102#ifdef ARCHITECTURE_x86_64 102#ifdef ARCHITECTURE_x86_64
103 if (VideoCore::g_shader_jit_enabled) { 103 if (VideoCore::g_shader_jit_enabled) {
104 u64 cache_key = 104 u64 cache_key =
105 Common::ComputeHash64(&g_state.vs.program_code, sizeof(g_state.vs.program_code)) ^ 105 Common::ComputeHash64(&program_code, sizeof(program_code)) ^
106 Common::ComputeHash64(&g_state.vs.swizzle_data, sizeof(g_state.vs.swizzle_data)); 106 Common::ComputeHash64(&swizzle_data, sizeof(swizzle_data));
107 107
108 auto iter = shader_map.find(cache_key); 108 auto iter = shader_map.find(cache_key);
109 if (iter != shader_map.end()) { 109 if (iter != shader_map.end()) {
@@ -122,33 +122,31 @@ MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240));
122 122
123void ShaderSetup::Run(UnitState& state) { 123void ShaderSetup::Run(UnitState& state) {
124 auto& config = g_state.regs.vs; 124 auto& config = g_state.regs.vs;
125 auto& setup = g_state.vs;
126 125
127 MICROPROFILE_SCOPE(GPU_Shader); 126 MICROPROFILE_SCOPE(GPU_Shader);
128 127
129#ifdef ARCHITECTURE_x86_64 128#ifdef ARCHITECTURE_x86_64
130 if (VideoCore::g_shader_jit_enabled) { 129 if (VideoCore::g_shader_jit_enabled) {
131 jit_shader->Run(setup, state, config.main_offset); 130 jit_shader->Run(*this, state, config.main_offset);
132 } else { 131 } else {
133 DebugData<false> dummy_debug_data; 132 DebugData<false> dummy_debug_data;
134 RunInterpreter(setup, state, dummy_debug_data, config.main_offset); 133 RunInterpreter(*this, state, dummy_debug_data, config.main_offset);
135 } 134 }
136#else 135#else
137 DebugData<false> dummy_debug_data; 136 DebugData<false> dummy_debug_data;
138 RunInterpreter(setup, state, dummy_debug_data, config.main_offset); 137 RunInterpreter(*this, state, dummy_debug_data, config.main_offset);
139#endif // ARCHITECTURE_x86_64 138#endif // ARCHITECTURE_x86_64
140} 139}
141 140
142DebugData<true> ShaderSetup::ProduceDebugInfo(const InputVertex& input, int num_attributes, 141DebugData<true> ShaderSetup::ProduceDebugInfo(const InputVertex& input, int num_attributes,
143 const Regs::ShaderConfig& config, 142 const Regs::ShaderConfig& config) {
144 const ShaderSetup& setup) {
145 UnitState state; 143 UnitState state;
146 DebugData<true> debug_data; 144 DebugData<true> debug_data;
147 145
148 // Setup input register table 146 // Setup input register table
149 boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero())); 147 boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero()));
150 state.LoadInputVertex(input, num_attributes); 148 state.LoadInputVertex(input, num_attributes);
151 RunInterpreter(setup, state, debug_data, config.main_offset); 149 RunInterpreter(*this, state, debug_data, config.main_offset);
152 return debug_data; 150 return debug_data;
153} 151}
154 152
diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h
index c5d23e0ea..61becb6e5 100644
--- a/src/video_core/shader/shader.h
+++ b/src/video_core/shader/shader.h
@@ -198,11 +198,10 @@ struct ShaderSetup {
198 * @param input Input vertex into the shader 198 * @param input Input vertex into the shader
199 * @param num_attributes The number of vertex shader attributes 199 * @param num_attributes The number of vertex shader attributes
200 * @param config Configuration object for the shader pipeline 200 * @param config Configuration object for the shader pipeline
201 * @param setup Setup object for the shader pipeline
202 * @return Debug information for this shader with regards to the given vertex 201 * @return Debug information for this shader with regards to the given vertex
203 */ 202 */
204 DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes, 203 DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes,
205 const Regs::ShaderConfig& config, const ShaderSetup& setup); 204 const Regs::ShaderConfig& config);
206}; 205};
207 206
208} // namespace Shader 207} // namespace Shader