mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-23 03:02:53 +01:00
rsx: Improve transform constants management
- Removes the duplicate local_transform_constants - Resets the transform constants on every context reset - Simplifies the code abit which should make it faster - NOTE: Transform constants are persistent across context re-init events (VF5)
This commit is contained in:
parent
a19ffba8e8
commit
dece1e01f4
@ -337,7 +337,6 @@ namespace rsx
|
||||
|
||||
void thread::end()
|
||||
{
|
||||
rsx::method_registers.transform_constants.clear();
|
||||
in_begin_end = false;
|
||||
|
||||
for (u8 index = 0; index < rsx::limits::vertex_count; ++index)
|
||||
@ -937,13 +936,7 @@ namespace rsx
|
||||
*/
|
||||
void thread::fill_vertex_program_constants_data(void *buffer)
|
||||
{
|
||||
//Some games dont initialize some registers that they use in the vertex stage
|
||||
memset(buffer, 0, 512 * 4 * sizeof(float));
|
||||
|
||||
for (const auto &entry : rsx::method_registers.transform_constants)
|
||||
local_transform_constants[entry.first] = entry.second;
|
||||
for (const auto &entry : local_transform_constants)
|
||||
stream_vector_from_memory((char*)buffer + entry.first * 4 * sizeof(float), (void*)entry.second.rgba);
|
||||
memcpy(buffer, rsx::method_registers.transform_constants.data(), 468 * 4 * sizeof(float));
|
||||
}
|
||||
|
||||
void thread::fill_fragment_state_buffer(void *buffer, const RSXFragmentProgram &fragment_program)
|
||||
|
@ -275,9 +275,6 @@ namespace rsx
|
||||
GcmTileInfo tiles[limits::tiles_count];
|
||||
GcmZcullInfo zculls[limits::zculls_count];
|
||||
|
||||
// Constant stored for whole frame
|
||||
std::unordered_map<u32, color4f> local_transform_constants;
|
||||
|
||||
bool capture_current_frame = false;
|
||||
void capture_frame(const std::string &name);
|
||||
|
||||
|
@ -334,7 +334,13 @@ namespace rsx
|
||||
static constexpr u8 subreg = index % 4;
|
||||
|
||||
u32 load = rsx::method_registers.transform_constant_load();
|
||||
rsx::method_registers.transform_constants[load + reg].rgba[subreg] = (f32&)arg;
|
||||
if ((load + index) >= 512)
|
||||
{
|
||||
LOG_ERROR(RSX, "Invalid register index (load=%d, index=%d)", load, index);
|
||||
return;
|
||||
}
|
||||
|
||||
rsx::method_registers.transform_constants[load + reg][subreg] = arg;
|
||||
rsxthr->m_transform_constants_dirty = true;
|
||||
}
|
||||
};
|
||||
|
@ -155,7 +155,7 @@ namespace rsx
|
||||
|
||||
|
||||
std::array<u32, 512 * 4> transform_program;
|
||||
std::unordered_map<u32, color4_base<f32>> transform_constants;
|
||||
std::array<u32[4], 512> transform_constants;
|
||||
|
||||
draw_clause current_draw_clause;
|
||||
|
||||
@ -183,7 +183,10 @@ namespace rsx
|
||||
fragment_textures(fill_array<fragment_texture>(registers, std::make_index_sequence<16>())),
|
||||
vertex_textures(fill_array<vertex_texture>(registers, std::make_index_sequence<4>())),
|
||||
vertex_arrays_info(fill_array<data_array_format_info>(registers, std::make_index_sequence<16>()))
|
||||
{ }
|
||||
{
|
||||
//NOTE: Transform constants persist through a context reset (NPEB00913)
|
||||
memset(transform_constants.data(), 0, 512 * 4 * sizeof(u32));
|
||||
}
|
||||
|
||||
~rsx_state() { }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user