VideoCore/Shader: Use self instead of g_state.vs in ShaderSetup
This commit is contained in:
parent
34d581f2dc
commit
e3caf669b0
|
@ -518,8 +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 = Pica::g_state.vs.ProduceDebugInfo(input_vertex, num_attributes, shader_config,
|
debug_data = shader_setup.ProduceDebugInfo(input_vertex, num_attributes, shader_config);
|
||||||
shader_setup);
|
|
||||||
|
|
||||||
// Reload widget state
|
// Reload widget state
|
||||||
for (int attr = 0; attr < num_attributes; ++attr) {
|
for (int attr = 0; attr < num_attributes; ++attr) {
|
||||||
|
|
|
@ -102,8 +102,8 @@ void ShaderSetup::Setup() {
|
||||||
#ifdef ARCHITECTURE_x86_64
|
#ifdef ARCHITECTURE_x86_64
|
||||||
if (VideoCore::g_shader_jit_enabled) {
|
if (VideoCore::g_shader_jit_enabled) {
|
||||||
u64 cache_key =
|
u64 cache_key =
|
||||||
Common::ComputeHash64(&g_state.vs.program_code, sizeof(g_state.vs.program_code)) ^
|
Common::ComputeHash64(&program_code, sizeof(program_code)) ^
|
||||||
Common::ComputeHash64(&g_state.vs.swizzle_data, sizeof(g_state.vs.swizzle_data));
|
Common::ComputeHash64(&swizzle_data, sizeof(swizzle_data));
|
||||||
|
|
||||||
auto iter = shader_map.find(cache_key);
|
auto iter = shader_map.find(cache_key);
|
||||||
if (iter != shader_map.end()) {
|
if (iter != shader_map.end()) {
|
||||||
|
@ -122,33 +122,31 @@ MICROPROFILE_DEFINE(GPU_Shader, "GPU", "Shader", MP_RGB(50, 50, 240));
|
||||||
|
|
||||||
void ShaderSetup::Run(UnitState& state) {
|
void ShaderSetup::Run(UnitState& state) {
|
||||||
auto& config = g_state.regs.vs;
|
auto& config = g_state.regs.vs;
|
||||||
auto& setup = g_state.vs;
|
|
||||||
|
|
||||||
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(setup, state, config.main_offset);
|
jit_shader->Run(*this, state, config.main_offset);
|
||||||
} else {
|
} else {
|
||||||
DebugData<false> dummy_debug_data;
|
DebugData<false> dummy_debug_data;
|
||||||
RunInterpreter(setup, state, dummy_debug_data, config.main_offset);
|
RunInterpreter(*this, state, dummy_debug_data, config.main_offset);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
DebugData<false> dummy_debug_data;
|
DebugData<false> dummy_debug_data;
|
||||||
RunInterpreter(setup, state, dummy_debug_data, config.main_offset);
|
RunInterpreter(*this, state, dummy_debug_data, config.main_offset);
|
||||||
#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,
|
const Regs::ShaderConfig& config) {
|
||||||
const ShaderSetup& setup) {
|
|
||||||
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(setup, state, debug_data, config.main_offset);
|
RunInterpreter(*this, state, debug_data, config.main_offset);
|
||||||
return debug_data;
|
return debug_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -198,11 +198,10 @@ struct ShaderSetup {
|
||||||
* @param input Input vertex into the shader
|
* @param input Input vertex into the shader
|
||||||
* @param num_attributes The number of vertex shader attributes
|
* @param num_attributes The number of vertex shader attributes
|
||||||
* @param config Configuration object for the shader pipeline
|
* @param config Configuration object for the shader pipeline
|
||||||
* @param setup Setup object for the shader pipeline
|
|
||||||
* @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, const ShaderSetup& setup);
|
const Regs::ShaderConfig& config);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Shader
|
} // namespace Shader
|
||||||
|
|
Reference in New Issue