mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
Fixup for multi-thread shader compilation (loading stage) (#9762)
* Multi-thread shader compilation This offers a huge improvement in startup performance. With around 13,000 shaders we go from ~1:30 to under 10 seconds. It looks like this was the original intention of the author given the outer scope recompile variable. Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
This commit is contained in:
parent
b858fceb4f
commit
48296c2ba6
@ -195,7 +195,9 @@ protected:
|
|||||||
std::tuple<const fragment_program_type&, bool> search_fragment_program(const RSXFragmentProgram& rsx_fp, bool force_load = true)
|
std::tuple<const fragment_program_type&, bool> search_fragment_program(const RSXFragmentProgram& rsx_fp, bool force_load = true)
|
||||||
{
|
{
|
||||||
bool recompile = false;
|
bool recompile = false;
|
||||||
|
typename binary_to_fragment_program::iterator it;
|
||||||
fragment_program_type* new_shader;
|
fragment_program_type* new_shader;
|
||||||
|
|
||||||
{
|
{
|
||||||
reader_lock lock(m_fragment_mutex);
|
reader_lock lock(m_fragment_mutex);
|
||||||
|
|
||||||
@ -213,15 +215,14 @@ protected:
|
|||||||
rsx_log.notice("FP not found in buffer!");
|
rsx_log.notice("FP not found in buffer!");
|
||||||
|
|
||||||
lock.upgrade();
|
lock.upgrade();
|
||||||
auto [it, inserted] = m_fragment_shader_cache.try_emplace(rsx_fp);
|
std::tie(it, recompile) = m_fragment_shader_cache.try_emplace(rsx_fp);
|
||||||
new_shader = &(it->second);
|
new_shader = &(it->second);
|
||||||
recompile = inserted;
|
}
|
||||||
|
|
||||||
if (inserted)
|
if (recompile)
|
||||||
{
|
{
|
||||||
it->first.clone_data();
|
it->first.clone_data();
|
||||||
backend_traits::recompile_fragment_program(rsx_fp, *new_shader, m_next_id++);
|
backend_traits::recompile_fragment_program(rsx_fp, *new_shader, m_next_id++);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::forward_as_tuple(*new_shader, false);
|
return std::forward_as_tuple(*new_shader, false);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user