rsx: Fix texture state propagation between unrelated draw calls

- Older games can load all textures before a draw sequence and then swap shaders for different draws.
- Optimizations in texture state streaming make it so that only referenced data is carried forward.
This commit is contained in:
kd-11 2021-11-08 20:58:24 +03:00 committed by kd-11
parent dc0793b731
commit 7e3eab9915
1 changed files with 10 additions and 0 deletions

View File

@ -1625,6 +1625,8 @@ namespace rsx
m_graphics_state &= ~rsx::pipeline_state::fragment_program_ucode_dirty;
const auto [program_offset, program_location] = method_registers.shader_program_address();
const auto prev_textures_reference_mask = current_fp_metadata.referenced_textures_mask;
auto data_ptr = vm::base(rsx::get_address(program_offset, program_location));
current_fp_metadata = program_hash_util::fragment_program_utils::analyse_fragment_program(data_ptr);
@ -1649,6 +1651,14 @@ namespace rsx
}
}
}
if (!(m_graphics_state & rsx::pipeline_state::fragment_program_state_dirty) &&
(prev_textures_reference_mask != current_fp_metadata.referenced_textures_mask))
{
// If different textures are used, upload their coefficients.
// The texture parameters transfer routine is optimized and only writes data for textures consumed by the ucode.
m_graphics_state |= rsx::pipeline_state::fragment_texture_state_dirty;
}
}
void thread::prefetch_vertex_program()