1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 18:53:28 +01:00

Savestates/RSX: Restore the ZCULL control state

And fix the ZCULL control state at the initial state of RSX.
This commit is contained in:
Eladash 2022-07-09 09:26:34 +03:00 committed by Ivan
parent 786510a937
commit 4ade06f36f
4 changed files with 27 additions and 15 deletions

View File

@ -451,10 +451,17 @@ namespace rsx
ar(dma_address, iomap_table, restore_point, tiles, zculls, display_buffers, display_buffers_count, current_display_buffer);
ar(enable_second_vhandler, requested_vsync);
ar(device_addr, label_addr, main_mem_size, local_mem_size, rsx_event_port, driver_info);
ar(in_begin_end, zcull_stats_enabled, zcull_rendering_enabled, zcull_pixel_cnt_enabled);
ar(in_begin_end);
if (!ar.is_writing() && GET_SERIALIZATION_VERSION(rsx) <= 2)
{
// Used to be ZCULL information we can obtain by reading method registers
ar.pos += 3;
}
ar(display_buffers, display_buffers_count, current_display_buffer);
if (ar.is_writing() || GET_SERIALIZATION_VERSION(rsx) != 1u)
if (ar.is_writing() || GET_SERIALIZATION_VERSION(rsx) != 1)
{
ar(unsent_gcm_events);
ar(rsx::method_registers.current_draw_clause);
@ -697,6 +704,11 @@ namespace rsx
}
}
namespace nv4097
{
void set_render_mode(thread* rsx, u32, u32 arg);
}
void thread::on_task()
{
g_tls_log_prefix = []
@ -721,6 +733,9 @@ namespace rsx
zcull_ctrl = std::make_unique<::rsx::reports::ZCULL_control>();
}
check_zcull_status(false);
nv4097::set_render_mode(this, 0, method_registers.registers[NV4097_SET_RENDER_ENABLE]);
performance_counters.state = FIFO_state::empty;
Emu.CallFromMainThread([]{ Emu.RunPPU(); });
@ -2295,6 +2310,8 @@ namespace rsx
void thread::reset()
{
rsx::method_registers.reset();
check_zcull_status(false);
nv4097::set_render_mode(this, 0, method_registers.registers[NV4097_SET_RENDER_ENABLE]);
m_graphics_state = pipeline_state::all_dirty;
m_rtts_dirty = true;
m_framebuffer_state_contested = false;
@ -2637,6 +2654,10 @@ namespace rsx
void thread::check_zcull_status(bool framebuffer_swap)
{
const bool zcull_rendering_enabled = !!method_registers.registers[NV4097_SET_ZCULL_EN];
const bool zcull_stats_enabled = !!method_registers.registers[NV4097_SET_ZCULL_STATS_ENABLE];
const bool zcull_pixel_cnt_enabled = !!method_registers.registers[NV4097_SET_ZPASS_PIXEL_COUNT_ENABLE];
if (framebuffer_swap)
{
zcull_surface_active = false;

View File

@ -671,10 +671,6 @@ namespace rsx
atomic_t<s32> async_tasks_pending{ 0 };
bool zcull_stats_enabled = false;
bool zcull_rendering_enabled = false;
bool zcull_pixel_cnt_enabled = false;
reports::conditional_render_eval cond_render_ctrl;
virtual u64 get_cycles() = 0;

View File

@ -745,19 +745,16 @@ namespace rsx
void set_zcull_render_enable(thread* rsx, u32, u32 arg)
{
rsx->zcull_rendering_enabled = !!arg;
rsx->notify_zcull_info_changed();
}
void set_zcull_stats_enable(thread* rsx, u32, u32 arg)
{
rsx->zcull_stats_enabled = !!arg;
rsx->notify_zcull_info_changed();
}
void set_zcull_pixel_count_enable(thread* rsx, u32, u32 arg)
{
rsx->zcull_pixel_cnt_enabled = !!arg;
rsx->notify_zcull_info_changed();
}
@ -1789,8 +1786,6 @@ namespace rsx
}
rsx->reset();
nv4097::set_zcull_render_enable(rsx, 0, 0x3);
nv4097::set_render_mode(rsx, 0, 0x0100'0000);
rsx->on_frame_end(arg);
rsx->request_emu_flip(arg);
vm::_ref<atomic_t<u128>>(rsx->label_addr + 0x10).store(u128{});

View File

@ -75,7 +75,7 @@ static std::array<serial_ver_t, 23> s_serial_versions;
#define SERIALIZATION_VER(name, identifier, ...) \
\
const bool s_##name##_serialization_fill = []() { ::s_serial_versions[identifier].compatible_versions = {__VA_ARGS__}; return true; }();\
const bool s_##name##_serialization_fill = []() { if (::s_serial_versions[identifier].compatible_versions.empty()) ::s_serial_versions[identifier].compatible_versions = {__VA_ARGS__}; return true; }();\
\
extern void using_##name##_serialization()\
{\
@ -101,7 +101,7 @@ SERIALIZATION_VER(lv2_config, 9, 1)
namespace rsx
{
SERIALIZATION_VER(rsx, 10, 1, 2)
SERIALIZATION_VER(rsx, 10, 1, 2, 3)
}
namespace np
@ -111,8 +111,8 @@ namespace np
#ifdef _MSC_VER
// Compiler bug, lambda function body does seem to inherit used namespace atleast for function decleration
SERIALIZATION_VER(rsx, 10, 1, 2)
SERIALIZATION_VER(sceNp, 11, 1)
SERIALIZATION_VER(rsx, 10)
SERIALIZATION_VER(sceNp, 11)
#endif
SERIALIZATION_VER(cellVdec, 12, 1)