diff --git a/rpcs3/Emu/RSX/GL/GLDraw.cpp b/rpcs3/Emu/RSX/GL/GLDraw.cpp index 259e66880f..31b237d5f1 100644 --- a/rpcs3/Emu/RSX/GL/GLDraw.cpp +++ b/rpcs3/Emu/RSX/GL/GLDraw.cpp @@ -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(); diff --git a/rpcs3/Emu/RSX/RSXThread.cpp b/rpcs3/Emu/RSX/RSXThread.cpp index 13776d6324..25cd3f9ca9 100644 --- a/rpcs3/Emu/RSX/RSXThread.cpp +++ b/rpcs3/Emu/RSX/RSXThread.cpp @@ -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, rsx::limits::vertex_textures_count>& sampler_descriptors) { if (!(m_graphics_state & rsx::pipeline_state::vertex_program_dirty)) diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index 77e862a67c..6f91648c7b 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -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, rsx::limits::fragment_textures_count>& sampler_descriptors); diff --git a/rpcs3/Emu/RSX/VK/VKDraw.cpp b/rpcs3/Emu/RSX/VK/VKDraw.cpp index 3d2c172e72..20a4313cad 100644 --- a/rpcs3/Emu/RSX/VK/VKDraw.cpp +++ b/rpcs3/Emu/RSX/VK/VKDraw.cpp @@ -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();