Triforce v0.8.5.2

Hotfix: the brightness flashes fixed without the fps cost (the readback wait only for ranges the CPU resets), and the Discord status names where Link is by default.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-28 15:45:28 -06:00
parent 0f7d57ac14
commit 8cb23131f9
13 changed files with 412 additions and 54 deletions

View File

@@ -28,6 +28,7 @@ struct Gpu {
int rec_waits = 0, flushes = 0, slices = 0, hangs = 0;
wr::Parts table;
uint64_t first_noted = 0; // (value_rec: the first part, emplace)
uint64_t range = 0; // ((11-28) the part whose write-back last covered the read's range, 0: none known)
void submit_up_to(size_t n) {
for (; sent < n && sent < parts.size(); sent++) note(sent);
@@ -45,6 +46,7 @@ struct Gpu {
// the calls readback_wait makes
uint64_t first_part() { return first_noted; }
wr::Parts::Entry look() { return table.of(value); }
uint64_t range_seq() { return range; }
int rec_wait(uint64_t seq) {
rec_waits++;
if (rec_wait_error_at >= 0 && rec_waits > rec_wait_error_at) return 2;
@@ -76,13 +78,25 @@ struct Gpu {
int main() {
// the switch: on unset or empty; set, it is its number (atoi, as the renderer's other switches: a word reads as 0, off)
CHECK("unset: off (0.8.5.1)", !wr::rec_end_on(nullptr));
CHECK("empty: off (0.8.5.1)", !wr::rec_end_on(""));
CHECK("unset: on", wr::rec_end_on(nullptr));
CHECK("empty: on", wr::rec_end_on(""));
CHECK("0: off", !wr::rec_end_on("0"));
CHECK("00: off", !wr::rec_end_on("00"));
CHECK("1: on", wr::rec_end_on("1"));
CHECK("2: on", wr::rec_end_on("2"));
CHECK("a word: off", !wr::rec_end_on("off"));
// ((Triforce, 11-28) the modes: unset, the CPU-written ranges; 0 off; 1 every readback (0.8.5); another number, 2
CHECK("mode unset: 2", wr::rec_end_mode(nullptr) == wr::kRecEndCpuWritten);
CHECK("mode empty: 2", wr::rec_end_mode("") == wr::kRecEndCpuWritten);
CHECK("mode 0: off", wr::rec_end_mode("0") == wr::kRecEndOff);
CHECK("mode a word: off", wr::rec_end_mode("off") == wr::kRecEndOff);
CHECK("mode 1: every readback", wr::rec_end_mode("1") == wr::kRecEndAll);
CHECK("mode 2", wr::rec_end_mode("2") == wr::kRecEndCpuWritten);
CHECK("mode 7: 2", wr::rec_end_mode("7") == wr::kRecEndCpuWritten);
CHECK("mode 2, the CPU writes it: the rule", wr::rec_end_applies(wr::kRecEndCpuWritten, true));
CHECK("mode 2, the CPU only reads it: the first part", !wr::rec_end_applies(wr::kRecEndCpuWritten, false));
CHECK("mode 1: the rule either way", wr::rec_end_applies(wr::kRecEndAll, false) && wr::rec_end_applies(wr::kRecEndAll, true));
CHECK("mode 0: never", !wr::rec_end_applies(wr::kRecEndOff, true));
// the parts' table: the newest part and whether it ended the recording; an older note changes nothing; a later recording
// under the same value takes the entry over from its first part; nothing for no value or no number; the oldest past the cap
@@ -167,6 +181,111 @@ int main() {
CHECK("error: not done", r.known && !r.ok && g.rec_waits == 2);
}
// ((11-28) Start next frame early: the tail began after part 11 (the scene's last), part 12 the tail. A tail that passed its
// verdict wrote nothing the game reads: the read stops at the scene's part, never waits for the tail. The table's notes)
{
wr::Parts t2;
t2.submitted(9, 10, false), t2.submitted(9, 11, false);
t2.tail_began(9);
CHECK("tail began: the scene's part noted, not passed yet", t2.of(9).scene_part == 11 && t2.of(9).scene_seq == 0);
t2.submitted(9, 12, true);
t2.tail_passed(9);
CHECK("tail passed: the scene's part is the readbacks' end", t2.of(9).scene_seq == 11 && t2.of(9).seq == 12);
t2.tail_passed(5);
CHECK("a pass for an unknown value: nothing", t2.of(5).seq == 0);
wr::Parts t3;
t3.submitted(4, 30, false), t3.tail_passed(4);
CHECK("passed with no tail begun: nothing (the last part as before)", t3.of(4).scene_seq == 0);
}
{ // the tail passed before the read: one wait, for the scene's part; the tail (12) is not waited for
Gpu g;
g.parts = {10, 11, 12};
g.sent = 3;
g.begin();
g.table.tail_began(g.value); // (noted after part 11's submit in the replay: here the entry's newest is 12, so set it)
g.table.by_value[g.value].scene_part = 11;
g.table.tail_passed(g.value);
g.rec_done = 0;
const wr::ReadbackWait r = wr::readback_wait(true, g);
CHECK("tail passed: known and done", r.known && r.ok);
CHECK("tail passed: one wait, for the scene's part", g.rec_waits == 1 && g.rec_done == 11 && !r.went_on);
}
{ // the read during the tail, before its verdict: waits for the scene's part, then stops once the tail is judged and passed
Gpu g;
g.parts = {10, 11, 12};
g.sent = 2;
g.step = 0; // (the tail's part not submitted while the reader waits)
g.begin();
g.table.tail_began(g.value); // (after part 11, the newest submitted)
struct Judged : Gpu {
int left = 2;
void flush() {
Gpu::flush();
if (--left == 0) table.tail_passed(value); // (the verdict comes while the reader slices)
}
} j;
static_cast<Gpu&>(j) = g;
const wr::ReadbackWait r = wr::readback_wait(true, j);
CHECK("judged during the wait: known and done", r.known && r.ok);
CHECK("judged during the wait: ends at the scene's part, the tail never waited for", j.rec_done == 11 && j.hangs == 0);
}
{ // a tail that failed its verdict (no pass noted): the last part, as the rule was
Gpu g;
g.parts = {10, 11, 12};
g.sent = 2;
g.begin();
g.table.tail_began(g.value);
const wr::ReadbackWait r = wr::readback_wait(true, g);
CHECK("tail failed: the last part", r.known && r.ok && g.rec_done == 12);
}
// ((11-28) the tail begun, its verdict not in yet (the worker threads' reads at the owner's save): the read's range was copied
// back by a scene part (10): one wait, for that part; the tail (12) never waited for, never submitted while the read waits)
{
Gpu g;
g.parts = {10, 11, 12};
g.sent = 2;
g.step = 0;
g.begin();
g.table.tail_began(g.value); // (after part 11)
g.range = 10;
const wr::ReadbackWait r = wr::readback_wait(true, g);
CHECK("range in a scene part: known and done", r.known && r.ok && !r.went_on);
CHECK("range in a scene part: one wait, for its part", g.rec_waits == 1 && g.rec_done == 10 && g.hangs == 0 && g.slices == 0);
}
{ // the same read with no scene part known to have covered its range: the tail's end, as before (here the timeline ends it)
Gpu g;
g.parts = {10, 11, 12};
g.sent = 2;
g.step = 1;
g.begin();
g.table.tail_began(g.value);
const wr::ReadbackWait r = wr::readback_wait(true, g);
CHECK("range not in a scene part: the last part", r.known && r.ok && g.rec_done == 12);
}
{ // a range the tail itself copied back (its part after the scene's): the last part
Gpu g;
g.parts = {10, 11, 12};
g.sent = 2;
g.step = 1;
g.begin();
g.table.tail_began(g.value);
g.range = 12;
const wr::ReadbackWait r = wr::readback_wait(true, g);
CHECK("range in the tail: the last part", r.known && r.ok && g.rec_done == 12);
}
{ // the read during the scene (the tail not begun): as the rule was, the last part; then, once the tail begins with its
// range a scene part's, it stops at that part
Gpu g;
g.parts = {10, 11, 12};
g.sent = 1;
g.step = 1;
g.begin();
g.range = 10;
const wr::ReadbackWait r = wr::readback_wait(true, g);
CHECK("no tail: the last part", r.known && r.ok && g.rec_done == 12);
}
// 20,000 random recordings: 1 to 8 parts, the read after 1 to all of them are submitted, the replay going on 0 to 3 parts at
// each call (0: stuck, the timeline reaching the value after some slices). The rule never ends before the last part is done
// (or the timeline at the value), never waits for a part not submitted, and never takes more waits than parts plus one; the