mirror of
https://github.com/valentderah/totk-pc-recomp.git
synced 2026-11-19 12:25:56 +00:00
With sync_ahead an exit line gives the run total of the waits at a pool invalidate, as the shadow log lines stop at frame 1800 without TOTK_TRACE=perf
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bc579c62e8
commit
234a10f413
5 files changed
+20
-3
No files matched your search
@@ -304,6 +304,7 @@ void vk_mem_shadow_sync(uint64_t fence); // fence: the value of the part about
|
||||
// vk_mem_mirror_prologue's copies, which read the shadow.
|
||||
int vk_mem_shadow_deferred(void);
|
||||
void vk_mem_shadow_prologue(VkCommandBuffer cb, uint64_t fence);
|
||||
void vk_mem_shadow_read_log(void); // at exit, with TOTK_SYNC_AHEAD: the run total of vk_mem_shadow_read's waits
|
||||
void vk_mem_gpu_pending(uint64_t addr, uint64_t size);
|
||||
void vk_gpu_written(uint64_t addr, uint64_t size);
|
||||
int vk_mem_flush_add_probe(void); // --probe-vkexec: the flush range list; 0 or the number of the failed check
|
||||
|
||||
@@ -339,6 +339,7 @@ void gfx_exit_log(void) {
|
||||
static int32_t done;
|
||||
rec_check_log();
|
||||
vk_texture_eager_log();
|
||||
vk_mem_shadow_read_log();
|
||||
if (gfx_replay_async() && r_started && !plat_xchg32(&done, 1)) replay_log(game_frames, 1);
|
||||
}
|
||||
|
||||
|
||||
+16
-1
@@ -1319,6 +1319,7 @@ void vk_mem_shadow_fence(void) {
|
||||
typedef struct { uint64_t addr, size, at; } SRead;
|
||||
static SRead sread[SREAD_N]; // shadow_lock: the ranges the game invalidated last, with the value issued then
|
||||
static uint64_t s_read_waits, s_read_ticks; // shadow_lock: since the last log
|
||||
static uint64_t r_read_waits, r_read_ticks, r_read_max; // shadow_lock: over the run (vk_mem_shadow_read_log)
|
||||
|
||||
void vk_mem_shadow_read(uint64_t addr, uint64_t size) {
|
||||
if (!shadow_on || !size || !nvn_sync_ahead_guard()) return;
|
||||
@@ -1342,8 +1343,22 @@ void vk_mem_shadow_read(uint64_t addr, uint64_t size) {
|
||||
NVN_BLOCKING();
|
||||
vk_sync_fence_wait(wait, UINT64_MAX);
|
||||
}
|
||||
uint64_t dt = qpc() - t0;
|
||||
plat_mutex_lock(&shadow_lock);
|
||||
s_read_waits++, s_read_ticks += qpc() - t0;
|
||||
s_read_waits++, s_read_ticks += dt;
|
||||
r_read_waits++, r_read_ticks += dt;
|
||||
if (dt > r_read_max) r_read_max = dt;
|
||||
plat_mutex_unlock(&shadow_lock);
|
||||
}
|
||||
|
||||
// The run total of the waits above, once at exit, while frame-ahead is in effect: without TOTK_TRACE=perf the shadow
|
||||
// log lines come only at frames 600 and 1800.
|
||||
void vk_mem_shadow_read_log(void) {
|
||||
static int32_t done;
|
||||
if (!shadow_on || !nvn_sync_ahead_on() || plat_xchg32(&done, 1)) return;
|
||||
plat_mutex_lock(&shadow_lock);
|
||||
rt_log("mem: the game waited for a GPU write it reads %llu times, %.1f ms in all, longest %.2f ms",
|
||||
(unsigned long long)r_read_waits, qpc_ms(r_read_ticks), qpc_ms(r_read_max));
|
||||
plat_mutex_unlock(&shadow_lock);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user