mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 01:49:59 -04:00
Record the large draw groups of a submission on several replay workers at once.
Stage 2 of NX2NAVI_REPLAY_WORKERS (default 0, the replay as before). A run of draws is cut into groups: a group ends where the render targets change after its first draw or clear, and before an inline uniform update, a mesh draw and a samples-passed counter op, which the submitting thread replays itself in the order of the stream. A group of 64 draws or more is first walked by a front pass on the submitting thread: it applies the state and binds, settles the CPU side of the timestamp reports and decides the render conditions in the order of the stream, and copies the replay state at the first op of each chunk. The workers and the submitting thread then take the chunks in order and record each into a command buffer of its own, which vk_sync_append puts into the part in the order of the stream. The frame's pass hooks (contact shadows, DLSS) run in a group's first chunk, which the others start after. What still depends on the order between chunks waits until every earlier chunk of the group is done: a texture lookup that would make or take back an entry returns nothing and the chunk replays the op again in turn, and so do the contact shadows' pass, per-object motion and the HDR pass's source. The tables the chunks share take locks (the shader table, the descriptor lists, mirror use and GPU write notes, uniform snapshot drops, target frames, the DLAA camera votes and the previous-frame motion notes); each chunk keeps its own occlusion query open, its own feedback memo and no pass marks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3618,10 +3618,25 @@ static void start_at(Tex *e, const TexKey *k, int taken_back) {
|
||||
start_line(e, NULL, gone_desc, gone_rel, e->og_start == START_COPY_GONE ? 2 : filled ? 3 : copied);
|
||||
}
|
||||
|
||||
// A replay worker's chunk before its turn (vk_exec.c "replay workers"): a lookup that would make or take back an entry
|
||||
// returns nothing and sets this; the chunk replays the op again once every earlier chunk is done, so entries are made,
|
||||
// initialised and taken back in the order of the stream, as the replay would.
|
||||
static _Thread_local int tex_deferred;
|
||||
int vk_texture_deferred(void) { return tex_deferred; }
|
||||
int vk_texture_deferred_take(void) {
|
||||
int d = tex_deferred;
|
||||
tex_deferred = 0;
|
||||
return d;
|
||||
}
|
||||
|
||||
static Tex *entry_of(const tex_t *t) {
|
||||
TexKey k;
|
||||
make_key(t, &k);
|
||||
Tex *e = nvn_hm_get(&by_key, &k);
|
||||
if ((!e || e->retiring || e->released) && vk_exec_turn_due()) {
|
||||
tex_deferred = 1;
|
||||
return NULL;
|
||||
}
|
||||
if (e && e->retiring) { // retired by disuse: the pool refresh leaves it out, any other lookup takes it back
|
||||
if (pool_ctx) return NULL;
|
||||
retire_cancel(e);
|
||||
|
||||
Reference in New Issue
Block a user