mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu.git
				synced 2025-05-12 00:45:25 +00:00 
			
		
		
		
	VideoCore/Shader: Use only entry_point as ShaderSetup param
This removes all implicit dependency of ShaderState on global PICA state.
This commit is contained in:
		
							parent
							
								
									e3caf669b0
								
							
						
					
					
						commit
						1e1f939817
					
				| @ -518,7 +518,7 @@ void GraphicsVertexShaderWidget::Reload(bool replace_vertex_data, void* vertex_d | |||||||
|     info.labels.insert({entry_point, "main"}); |     info.labels.insert({entry_point, "main"}); | ||||||
| 
 | 
 | ||||||
|     // Generate debug information
 |     // Generate debug information
 | ||||||
|     debug_data = shader_setup.ProduceDebugInfo(input_vertex, num_attributes, shader_config); |     debug_data = shader_setup.ProduceDebugInfo(input_vertex, num_attributes, entry_point); | ||||||
| 
 | 
 | ||||||
|     // Reload widget state
 |     // Reload widget state
 | ||||||
|     for (int attr = 0; attr < num_attributes; ++attr) { |     for (int attr = 0; attr < num_attributes; ++attr) { | ||||||
|  | |||||||
| @ -150,7 +150,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||||||
|                         g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, |                         g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, | ||||||
|                                                  static_cast<void*>(&immediate_input)); |                                                  static_cast<void*>(&immediate_input)); | ||||||
|                     shader_unit.LoadInputVertex(immediate_input, regs.vs.num_input_attributes + 1); |                     shader_unit.LoadInputVertex(immediate_input, regs.vs.num_input_attributes + 1); | ||||||
|                     g_state.vs.Run(shader_unit); |                     g_state.vs.Run(shader_unit, regs.vs.main_offset); | ||||||
|                     Shader::OutputVertex output_vertex = |                     Shader::OutputVertex output_vertex = | ||||||
|                         shader_unit.output_registers.ToVertex(regs.vs); |                         shader_unit.output_registers.ToVertex(regs.vs); | ||||||
| 
 | 
 | ||||||
| @ -285,7 +285,7 @@ static void WritePicaReg(u32 id, u32 value, u32 mask) { | |||||||
|                     g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, |                     g_debug_context->OnEvent(DebugContext::Event::VertexShaderInvocation, | ||||||
|                                              (void*)&input); |                                              (void*)&input); | ||||||
|                 shader_unit.LoadInputVertex(input, loader.GetNumTotalAttributes()); |                 shader_unit.LoadInputVertex(input, loader.GetNumTotalAttributes()); | ||||||
|                 g_state.vs.Run(shader_unit); |                 g_state.vs.Run(shader_unit, regs.vs.main_offset); | ||||||
| 
 | 
 | ||||||
|                 // Retrieve vertex from register data
 |                 // Retrieve vertex from register data
 | ||||||
|                 output_vertex = shader_unit.output_registers.ToVertex(regs.vs); |                 output_vertex = shader_unit.output_registers.ToVertex(regs.vs); | ||||||
|  | |||||||
| @ -120,33 +120,35 @@ void ShaderSetup::Setup() { | |||||||
| 
 | 
 | ||||||
| MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240)); | MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240)); | ||||||
| 
 | 
 | ||||||
| void ShaderSetup::Run(UnitState& state) { | void ShaderSetup::Run(UnitState& state, unsigned int entry_point) { | ||||||
|     auto& config = g_state.regs.vs; |     ASSERT(entry_point < 1024); | ||||||
| 
 | 
 | ||||||
|     MICROPROFILE_SCOPE(GPU_Shader); |     MICROPROFILE_SCOPE(GPU_Shader); | ||||||
| 
 | 
 | ||||||
| #ifdef ARCHITECTURE_x86_64 | #ifdef ARCHITECTURE_x86_64 | ||||||
|     if (VideoCore::g_shader_jit_enabled) { |     if (VideoCore::g_shader_jit_enabled) { | ||||||
|         jit_shader->Run(*this, state, config.main_offset); |         jit_shader->Run(*this, state, entry_point); | ||||||
|     } else { |     } else { | ||||||
|         DebugData<false> dummy_debug_data; |         DebugData<false> dummy_debug_data; | ||||||
|         RunInterpreter(*this, state, dummy_debug_data, config.main_offset); |         RunInterpreter(*this, state, dummy_debug_data, entry_point); | ||||||
|     } |     } | ||||||
| #else | #else | ||||||
|     DebugData<false> dummy_debug_data; |     DebugData<false> dummy_debug_data; | ||||||
|     RunInterpreter(*this, state, dummy_debug_data, config.main_offset); |     RunInterpreter(*this, state, dummy_debug_data, entry_point); | ||||||
| #endif // ARCHITECTURE_x86_64
 | #endif // ARCHITECTURE_x86_64
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| DebugData<true> ShaderSetup::ProduceDebugInfo(const InputVertex& input, int num_attributes, | DebugData<true> ShaderSetup::ProduceDebugInfo(const InputVertex& input, int num_attributes, | ||||||
|                                               const Regs::ShaderConfig& config) { |                                               unsigned int entry_point) { | ||||||
|  |     ASSERT(entry_point < 1024); | ||||||
|  | 
 | ||||||
|     UnitState state; |     UnitState state; | ||||||
|     DebugData<true> debug_data; |     DebugData<true> debug_data; | ||||||
| 
 | 
 | ||||||
|     // Setup input register table
 |     // Setup input register table
 | ||||||
|     boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero())); |     boost::fill(state.registers.input, Math::Vec4<float24>::AssignToAll(float24::Zero())); | ||||||
|     state.LoadInputVertex(input, num_attributes); |     state.LoadInputVertex(input, num_attributes); | ||||||
|     RunInterpreter(*this, state, debug_data, config.main_offset); |     RunInterpreter(*this, state, debug_data, entry_point); | ||||||
|     return debug_data; |     return debug_data; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -191,7 +191,7 @@ struct ShaderSetup { | |||||||
|      * Runs the currently setup shader |      * Runs the currently setup shader | ||||||
|      * @param state Shader unit state, must be setup per shader and per shader unit |      * @param state Shader unit state, must be setup per shader and per shader unit | ||||||
|      */ |      */ | ||||||
|     void Run(UnitState& state); |     void Run(UnitState& state, unsigned int entry_point); | ||||||
| 
 | 
 | ||||||
|     /**
 |     /**
 | ||||||
|      * Produce debug information based on the given shader and input vertex |      * Produce debug information based on the given shader and input vertex | ||||||
| @ -201,7 +201,7 @@ struct ShaderSetup { | |||||||
|      * @return Debug information for this shader with regards to the given vertex |      * @return Debug information for this shader with regards to the given vertex | ||||||
|      */ |      */ | ||||||
|     DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes, |     DebugData<true> ProduceDebugInfo(const InputVertex& input, int num_attributes, | ||||||
|                                      const Regs::ShaderConfig& config); |                                      unsigned int entry_point); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| } // namespace Shader
 | } // namespace Shader
 | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Yuri Kunde Schlesner
						Yuri Kunde Schlesner