rsx: Move shader analysis+prefetch to the end of the draw call

This commit is contained in:
kd-11 2020-12-13 13:39:58 +03:00 committed by kd-11
parent 8e07b19bc7
commit d775c8dc73
4 changed files with 20 additions and 14 deletions

View File

@ -612,10 +612,10 @@ void GLGSRender::end()
return;
}
analyse_current_rsx_pipeline();
m_frame_stats.setup_time += m_profiler.duration();
// Active texture environment is used to decode shaders
m_profiler.start();
load_texture_env();
m_frame_stats.textures_upload_time += m_profiler.duration();

View File

@ -360,16 +360,6 @@ namespace rsx
}
}
if (m_graphics_state & rsx::pipeline_state::fragment_program_ucode_dirty)
{
// Request for update of fragment constants if the program block is invalidated
m_graphics_state |= rsx::pipeline_state::fragment_constants_dirty;
}
// Preload the GPU programs for this draw call if needed
prefetch_vertex_program();
prefetch_fragment_program();
in_begin_end = true;
}
@ -1575,6 +1565,18 @@ namespace rsx
}
}
void thread::analyse_current_rsx_pipeline()
{
if (m_graphics_state & rsx::pipeline_state::fragment_program_ucode_dirty)
{
// Request for update of fragment constants if the program block is invalidated
m_graphics_state |= rsx::pipeline_state::fragment_constants_dirty;
}
prefetch_vertex_program();
prefetch_fragment_program();
}
void thread::get_current_vertex_program(const std::array<std::unique_ptr<rsx::sampled_image_descriptor_base>, rsx::limits::vertex_textures_count>& sampler_descriptors)
{
if (!(m_graphics_state & rsx::pipeline_state::vertex_program_dirty))

View File

@ -773,6 +773,9 @@ namespace rsx
RSXVertexProgram current_vertex_program = {};
RSXFragmentProgram current_fragment_program = {};
// Runs shader prefetch and resolves pipeline status flags
void analyse_current_rsx_pipeline();
// Prefetch and analyze the currently active fragment program ucode
void prefetch_fragment_program();
@ -783,8 +786,6 @@ namespace rsx
/**
* Gets current fragment program and associated fragment state
* get_surface_info is a helper takes 2 parameters: rsx_texture_address and surface_is_depth
* returns whether surface is a render target and surface pitch in native format
*/
void get_current_fragment_program(const std::array<std::unique_ptr<rsx::sampled_image_descriptor_base>, rsx::limits::fragment_textures_count>& sampler_descriptors);

View File

@ -894,6 +894,8 @@ void VKGSRender::end()
return;
}
m_profiler.start();
// Check for frame resource status here because it is possible for an async flip to happen between begin/end
if (m_current_frame->flags & frame_context_state::dirty) [[unlikely]]
{
@ -916,7 +918,8 @@ void VKGSRender::end()
m_current_frame->flags &= ~frame_context_state::dirty;
}
m_profiler.start();
analyse_current_rsx_pipeline();
m_frame_stats.setup_time += m_profiler.duration();
load_texture_env();
m_frame_stats.textures_upload_time += m_profiler.duration();