diff options
| author | 2016-12-16 22:30:00 -0800 | |
|---|---|---|
| committer | 2017-01-25 18:53:23 -0800 | |
| commit | 1e1f9398176e4f1ec608f31f22a576c749a0a723 (patch) | |
| tree | 1c2ced663dcfe434ae0750f0ca64590c1f1dba5f /src/video_core | |
| parent | VideoCore/Shader: Use self instead of g_state.vs in ShaderSetup (diff) | |
| download | yuzu-1e1f9398176e4f1ec608f31f22a576c749a0a723.tar.gz yuzu-1e1f9398176e4f1ec608f31f22a576c749a0a723.tar.xz yuzu-1e1f9398176e4f1ec608f31f22a576c749a0a723.zip | |
VideoCore/Shader: Use only entry_point as ShaderSetup param
This removes all implicit dependency of ShaderState on global PICA
state.
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/command_processor.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/shader/shader.cpp | 16 | ||||
| -rw-r--r-- | src/video_core/shader/shader.h | 4 |
3 files changed, 13 insertions, 11 deletions
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index 36f72393b..fc224c6f2 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp | |||
| @@ -150,7 +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_unit.LoadInputVertex(immediate_input, regs.vs.num_input_attributes + 1); | 152 | shader_unit.LoadInputVertex(immediate_input, regs.vs.num_input_attributes + 1); |
| 153 | g_state.vs.Run(shader_unit); | 153 | g_state.vs.Run(shader_unit, regs.vs.main_offset); |
| 154 | Shader::OutputVertex output_vertex = | 154 | Shader::OutputVertex output_vertex = |
| 155 | shader_unit.output_registers.ToVertex(regs.vs); | 155 | shader_unit.output_registers.ToVertex(regs.vs); |
| 156 | 156 | ||
| @@ -285,7 +285,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||
| 285 | g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, | 285 | g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, |
| 286 | (void*)&input); | 286 | (void*)&input); |
| 287 | shader_unit.LoadInputVertex(input, loader.GetNumTotalAttributes()); | 287 | shader_unit.LoadInputVertex(input, loader.GetNumTotalAttributes()); |
| 288 | g_state.vs.Run(shader_unit); | 288 | g_state.vs.Run(shader_unit, regs.vs.main_offset); |
| 289 | 289 | ||
| 290 | // Retrieve vertex from register data | 290 | // Retrieve vertex from register data |
| 291 | output_vertex = shader_unit.output_registers.ToVertex(regs.vs); | 291 | output_vertex = shader_unit.output_registers.ToVertex(regs.vs); |
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index 868be1360..936db0582 100644 --- a/src/video_core/shader/shader.cpp +++ b/src/video_core/shader/shader.cpp | |||
| @@ -120,33 +120,35 @@ void ShaderSetup::Setup() { | |||
| 120 | 120 | ||
| 121 | MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240)); | 121 | MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240)); |
| 122 | 122 | ||
| 123 | void ShaderSetup::Run(UnitState& state) { | 123 | void ShaderSetup::Run(UnitState& state, unsigned int entry_point) { |
| 124 | auto& config = g_state.regs.vs; | 124 | ASSERT(entry_point < 1024); |
| 125 | 125 | ||
| 126 | MICROPROFILE_SCOPE(GPU_Shader); | 126 | MICROPROFILE_SCOPE(GPU_Shader); |
| 127 | 127 | ||
| 128 | #ifdef ARCHITECTURE_x86_64 | 128 | #ifdef ARCHITECTURE_x86_64 |
| 129 | if (VideoCore::g_shader_jit_enabled) { | 129 | if (VideoCore::g_shader_jit_enabled) { |
| 130 | jit_shader->Run(*this, state, config.main_offset); | 130 | jit_shader->Run(*this, state, entry_point); |
| 131 | } else { | 131 | } else { |
| 132 | DebugData<false> dummy_debug_data; | 132 | DebugData<false> dummy_debug_data; |
| 133 | RunInterpreter(*this, state, dummy_debug_data, config.main_offset); | 133 | RunInterpreter(*this, state, dummy_debug_data, entry_point); |
| 134 | } | 134 | } |
| 135 | #else | 135 | #else |
| 136 | DebugData<false> dummy_debug_data; | 136 | DebugData<false> dummy_debug_data; |
| 137 | RunInterpreter(*this, state, dummy_debug_data, config.main_offset); | 137 | RunInterpreter(*this, state, dummy_debug_data, entry_point); |
| 138 | #endif // ARCHITECTURE_x86_64 | 138 | #endif // ARCHITECTURE_x86_64 |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | DebugData<true> ShaderSetup::ProduceDebugInfo(const InputVertex& input, int num_attributes, | 141 | DebugData<true> ShaderSetup::ProduceDebugInfo(const InputVertex& input, int num_attributes, |
| 142 | const Regs::ShaderConfig& config) { | 142 | unsigned int entry_point) { |
| 143 | ASSERT(entry_point < 1024); | ||
| 144 | |||
| 143 | UnitState state; | 145 | UnitState state; |
| 144 | DebugData<true> debug_data; | 146 | DebugData<true> debug_data; |
| 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 | state.LoadInputVertex(input, num_attributes); | 150 | state.LoadInputVertex(input, num_attributes); |
| 149 | RunInterpreter(*this, state, debug_data, config.main_offset); | 151 | RunInterpreter(*this, state, debug_data, entry_point); |
| 150 | return debug_data; | 152 | return debug_data; |
| 151 | } | 153 | } |
| 152 | 154 | ||
diff --git a/src/video_core/shader/shader.h b/src/video_core/shader/shader.h index 61becb6e5..d21f481ab 100644 --- a/src/video_core/shader/shader.h +++ b/src/video_core/shader/shader.h | |||
| @@ -191,7 +191,7 @@ struct ShaderSetup { | |||
| 191 | * Runs the currently setup shader | 191 | * Runs the currently setup shader |
| 192 | * @param state Shader unit state, must be setup per shader and per shader unit | 192 | * @param state Shader unit state, must be setup per shader and per shader unit |
| 193 | */ | 193 | */ |
| 194 | void Run(UnitState& state); | 194 | void Run(UnitState& state, unsigned int entry_point); |
| 195 | 195 | ||
| 196 | /** | 196 | /** |
| 197 | * Produce debug information based on the given shader and input vertex | 197 | * Produce debug information based on the given shader and input vertex |
| @@ -201,7 +201,7 @@ struct ShaderSetup { | |||
| 201 | * @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 |
| 202 | */ | 202 | */ |
| 203 | DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes, | 203 | DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes, |
| 204 | const Regs::ShaderConfig& config); | 204 | unsigned int entry_point); |
| 205 | }; | 205 | }; |
| 206 | 206 | ||
| 207 | } // namespace Shader | 207 | } // namespace Shader |