Triforce v0.9.0

Character tab, faster renderer defaults, HD rumble shipped, and the 11-30 bug pass: ending softlock below 60 fps, adult first-night lock, Intel Arc robust buffers, adult map, randomizer load order.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-30 20:55:14 -06:00
parent 8cb23131f9
commit 822ee913bc
86 changed files with 8128 additions and 438 deletions

View File

@@ -11,7 +11,9 @@ to come in a later part.
Compiles and runs the header's rule against a made-up GPU (tests/test_readback_rec_end.cpp: the parts' table, the meter's case,
an ended recording, one part, not known, a stuck replay ended by the timeline, an error, and 20,000 random recordings: never back
before the last part is done, never a wait for a part not submitted; the old wait ends at the first part at every read that came
before the recording's end), and reads the source for what needs the game:
before the recording's end; (11-29) RX_VK_RB_REC_END=3's wait for a range the CPU only reads, readback_range_wait: at the part
that copied the range back, never before it, past it only by the timeline, the last part when none did; 20,000 random recordings
again), and reads the source for what needs the game:
- submit_recording's registration notes every submit, part or end, by the recording's own value, under rec_map_mu;
- readback_rec_wait runs the header's rule by RX_VK_RB_REC_END, looks the tables up under rec_map_mu, flushes the held submits
before it waits on the recordings' timeline (a batched recording's signal goes out only with the batch), and slices the
@@ -56,7 +58,8 @@ def in_order(text, needles, where):
def check_source():
head = (ROOT / "gpu/vk/wb_rec_wait.h").read_text(encoding="utf-8")
for needle in ("struct Parts {", "inline bool rec_end_on(const char* text)", "struct ReadbackWait {",
"ReadbackWait readback_wait(bool rec_end, D& d) {",
"ReadbackWait readback_wait(bool rec_end, D& d) {", "ReadbackWait readback_range_wait(D& d) {",
"inline bool range_applies(int mode, bool cpu_written) { return mode == kRecEndRange && !cpu_written; }",
"void part_submitted(uint64_t value, uint64_t seq, bool part) { submitted(value, seq, !part); }"):
check(needle in head, "gpu/vk/wb_rec_wait.h: %s is missing" % needle)
@@ -72,20 +75,38 @@ def check_source():
"vk_replay.cpp: the parts are noted somewhere past the registration")
on = function(replay, "int rb_rec_end_mode() {")
check('wr::rec_end_mode(getenv("RX_VK_RB_REC_END"))' in on and "static const int v" in on,
check('const char* e = getenv("RX_VK_RB_REC_END");' in on and "static const int v" in on,
"RX_VK_RB_REC_END is not read once through the header's rule")
# ((Triforce, 11-29, the owner's decision) unset: 3 where the parts end at the game's render passes (their first part is
# ~32 draws, and mode 2 read a later part's result a frame late: the brightness pulses), else 2 as before
check("const int m = wr::rec_end_mode(e, parts ? wr::kRecEndRange : wr::kRecEndCpuWritten);" in on
and "const bool parts = pass_end_parts_on();" in on,
"RX_VK_RB_REC_END's default is not 3 with the pass-end parts and 2 with counted parts")
ends = function(replay, "PassEndParts& pass_end_parts() {")
check("rb_rec_end_mode(" not in ends and "rb_rec_end_on(" not in ends,
"pass_end_parts asks the readback mode's reader, which asks pass_end_parts: the two statics would wait on each other")
check('rec_end_mode(getenv("RX_VK_RB_REC_END"), ::mkwvk::wb_rec_wait::kRecEndRange)' in ends
and 'num("RX_VK_PART_RB", range ? 32 : 0)' in ends,
"RX_VK_PART_RB's default does not follow mode 3 (32 there, off with another mode set)")
# ((Triforce, 11-28) mode 2, the default: the last-part rule only where the CPU writes the range after reading it)
fr = function(replay, "bool rb_rec_end_for(uint64_t guest, uint64_t size) {")
check("m == wr::kRecEndCpuWritten && memory_rb_cpu_written(guest, size)" in fr and "return wr::rec_end_applies(m, cpu);" in fr,
"rb_rec_end_for does not ask the memory whether the CPU writes the range (mode 2) through the header's rule")
# ((11-29) mode 3: the same, and a range the CPU only reads at the part that copied it back, by the header's range_applies)
fr = function(replay, "bool rb_rec_end_for(uint64_t guest, uint64_t size, bool* range) {")
check("(m == wr::kRecEndCpuWritten || m == wr::kRecEndRange) && memory_rb_cpu_written(guest, size)" in fr
and "return wr::rec_end_applies(m, cpu);" in fr,
"rb_rec_end_for does not ask the memory whether the CPU writes the range (modes 2 and 3) through the header's rule")
check("*range = wr::range_applies(m, cpu);" in fr, "rb_rec_end_for does not say a read-only range's wait (mode 3) by the header's rule")
mem = (ROOT / "gpu/vk/vk_memory.cpp").read_text(encoding="utf-8")
check(mem.count("memory_rb_cpu_collected(pages, n);") == 2, "the two collections of the CPU's pages do not both note the read-back pages")
check("memory_rb_watch(guest, size);" in function(mem, "void memory_note_readback(uint64_t guest, uint64_t size) {"),
"a readback's pages are not watched for the CPU's writes")
w = function(replay, "bool readback_rec_wait(uint64_t v, uint64_t guest, uint64_t size, int* ok) {")
w = function(replay, "bool readback_rec_wait(uint64_t v, uint64_t guest, uint64_t size, int* ok, bool range) {")
for needle, why in (
("if (!rec_timeline || per_queue_fences_off()) return false;", "it waits by recordings where there are none"),
("::mkwvk::wb_rec_wait::readback_wait(rb_rec_end_on(), calls);", "it does not run the header's rule by the switch"),
("range ? ::mkwvk::wb_rec_wait::readback_range_wait(calls) : ::mkwvk::wb_rec_wait::readback_wait(rb_rec_end_on(), calls);",
"it does not run the header's rule by the switch, or a read-only range's wait (mode 3) by the header's"),
("uint64_t range_seq() { return memory_wb_part_seq(guest, size, v); }",
"the range's part is not the memory's part that copied the range back under v"),
("st_rb_range.fetch_add(1, std::memory_order_relaxed);", "the read-only ranges' waits (mode 3) are not counted"),
("return rec_parts_by_value.of(v);", "it does not look the parts up"),
("const auto it = value_rec.find(v);", "the old lookup is not value_rec's"),
("void flush() { queue_flush_for(FR_WAIT); }", "its looks do not flush the held submits"),
@@ -101,8 +122,10 @@ def check_source():
check("pSemaphores = &rec_timeline;" in rw and "UINT64_MAX" in rw, "the recording's wait is not the recordings' timeline, unbounded")
both = function(replay, "bool readback_recorded_wait(uint64_t v, uint64_t guest, uint64_t size, int* ok) {")
check("return rb_rec_end_for(guest, size) ? readback_rec_wait(v, guest, size, ok) : wait_recorded(v, UINT64_MAX, ok);" in both,
"readback_recorded_wait does not take the rule by the switch (the old wait kept for =0)")
in_order(both, ["bool range = false;",
"if (rb_rec_end_for(guest, size, &range)) return readback_rec_wait(v, guest, size, ok, false);",
"return range ? readback_rec_wait(v, guest, size, ok, true) : wait_recorded(v, UINT64_MAX, ok);"],
"readback_recorded_wait (the rule by the switch, a read-only range at its part for =3, the old wait kept for =0 and 2)")
inv = function(replay, "void invalidate(uint64_t gpu, uint64_t size) {")
check(inv.count("readback_recorded_wait(v, host->gpu_guest(gpu), size, &ok)") == 2, "invalidate's two waits by recordings do not both take the rule")
check("if (!(unforced && readback_recorded_wait(v, host->gpu_guest(gpu), size, &ok))) {" in inv, "the submitting thread's wait does not take the rule")
@@ -120,11 +143,39 @@ def check_source():
gl = function(replay, "void readback_went_on_line() {")
check("st_rb_went_on.exchange(0)" in gl and "(RX_VK_RB_REC_END=0: the first part, as before)" in gl,
"the 3000-readback line does not count the reads that waited past a part")
check("st_rb_range.exchange(0)" in gl and "st_rb_range_later.exchange(0)" in gl,
"the 3000-readback line does not count the read-only ranges' waits (mode 3) and those past the first part")
dev = (ROOT / "docs/development.md").read_text(encoding="utf-8")
rows = [line for line in dev.splitlines() if line.startswith("| `RX_VK_RB_REC_END=0` |")]
check(len(rows) == 1, "docs/development.md: RX_VK_RB_REC_END is not in the switches table once")
check("tests/test_readback_rec_end.py" in rows[0] and "wb_rec_wait.h" in rows[0], "docs/development.md: the row names neither the rule nor its test")
check("`=3`" in rows[0], "docs/development.md: the RX_VK_RB_REC_END row does not say mode 3")
# ((Triforce, 11-29) RX_VK_LATE_PART: the queue's late-page wait at the part that wrote the pages back last, the value's
# wait as before whenever that part is not known; off unless set (or the lab knob latepart))
flush = function(replay, "void late_fix_flush_locked() {")
in_order(flush, ["const uint64_t v = memory_late_fix_pending();", "if (completed() < v && !late_fix_part_wait()) {",
"vk_timeline_wait_sent(v)", "memory_late_fix_apply(UINT64_MAX);"],
"late_fix_flush_locked (the part's wait first, the value's when it was not made, then the fixes)")
pw = function(replay, "bool late_fix_part_wait() {")
in_order(pw, ["if (!rec_timeline || !memory_late_part_on()) return false;", "const uint64_t seq = memory_late_fix_part();",
"if (!seq) {", "wi.pSemaphores = &rec_timeline, wi.pValues = &seq;", "return done;"],
"late_fix_part_wait (off, no timeline or no part known: the value's wait)")
mem_on = function(mem, "bool memory_late_part_on() {")
check('getenv("RX_VK_LATE_PART")' in mem_on and 'lab_ab::on("latepart")' in mem_on and "atoi(e) != 0" in mem_on,
"RX_VK_LATE_PART is not off unless set, with the lab knob latepart")
lp = function(mem, "uint64_t late_pages_part(const std::vector<std::pair<uint32_t, uint32_t>>& slots, uint64_t done) {")
in_order(lp, ["std::lock_guard lk(wb_pages_mu);", "if (wb_runs_lost > done) return 0;", "if (r.value <= done",
"if (b == wb_batch_seq.end()) return 0;", "part = std::max(part, b->second);"],
"late_pages_part (a run cut or a part not submitted: not known)")
fp = function(mem, "uint64_t memory_late_fix_part() {")
check("if (!f.part) return 0;" in fp, "memory_late_fix_part does not give 0 when one pending fix's part is not known")
check("if (memory_late_part_on()) f.part = late_pages_part(f.slots, vk_timeline_completed());" in mem,
"the take does not note a put-off fix's part")
lrows = [line for line in dev.splitlines() if line.startswith("| `RX_VK_LATE_PART=1` |")]
check(len(lrows) == 1 and "off unless set" in lrows[0] and "tests/test_readback_rec_end.py" in lrows[0],
"docs/development.md: no RX_VK_LATE_PART row naming its default and its test")
def main():