mirror of
https://git.triforceproject.com/triforce/source
synced 2026-11-29 04:18:49 -04:00
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:
@@ -172,6 +172,10 @@ void memory_end_submission(VkCommandBuffer cmd) {
|
||||
noted.clear();
|
||||
}
|
||||
void memory_begin_submission() { noted.clear(); }
|
||||
// ((11-28) the replay's calls the cut functions make that the model has no part in: the readbacks' tail notes (vk_replay.cpp
|
||||
// rb_tail_note) and the last piece of a recording's uploads (vk_texture.cpp texture_upload_last: one piece here)
|
||||
void rb_tail_note(uint64_t, bool) {}
|
||||
VkCommandBuffer texture_upload_last(VkCommandBuffer base) { return base; }
|
||||
Recording& begin_recording(uint64_t value) {
|
||||
recordings.push_back(std::make_unique<Recording>());
|
||||
Recording& r = *recordings.back();
|
||||
|
||||
@@ -90,10 +90,12 @@ int main(int argc, char **argv) {
|
||||
const DiscordFields no_tokens = {"Kokiri Forest", "KokiriForest_Child", "Child", "v3.0.0", "", "", "v3.0.0", "3", "3", "0", "", ""};
|
||||
DiscordSettings s;
|
||||
discord_settings_default(&s);
|
||||
/* (the default: as before, "Triforce" and the release, in a map or not) */
|
||||
CHECK(lines(s.status, &play, "Triforce v3.0.0-rc.7-25-g7a029028", "") && lines(s.status, &title, "Triforce v3.0.0-rc.7-25-g7a029028", ""));
|
||||
/* ((Triforce, 11-28) the default: the place (DISCORD_TEXT_PLACE) in a map, the version on the title screen */
|
||||
CHECK(!strcmp(s.status, DISCORD_TEXT_PLACE));
|
||||
CHECK(lines(s.status, &play, "Kakariko Village - Adult", "") && lines(s.status, &title, "v3.0.0 RC7", ""));
|
||||
CHECK(lines(s.image_text, &release, "Triforce v3.0.0", "") && !strcmp(s.image, DISCORD_IMAGE_DEFAULT));
|
||||
CHECK(!discord_settings_use_game(&s)); /* (the game's state is not read for it) */
|
||||
CHECK(discord_settings_use_game(&s)); /* (the game's state is read for it) */
|
||||
CHECK(discord_settings_line(&s, "discord_text=Triforce {release}\n") && !discord_settings_use_game(&s)); /* (the old one: not read) */
|
||||
CHECK(discord_settings_line(&s, "discord_text=" DISCORD_TEXT_PLACE "\n") && discord_settings_use_game(&s));
|
||||
CHECK(discord_settings_line(&s, "discord_text={!age|x}") && discord_settings_use_game(&s));
|
||||
CHECK(discord_settings_line(&s, "discord_text={version} {mapx}") && !discord_settings_use_game(&s));
|
||||
@@ -273,7 +275,7 @@ def main():
|
||||
stamp = {"start": 1700000000}
|
||||
logo = "triangle_emblem_discord_zoomed_out_transparent" # (Triforce's art, as before)
|
||||
want = {
|
||||
"plain": {"details": "Triforce v3.0.0", "timestamps": stamp,
|
||||
"plain": {"details": "Kakariko Village - Adult", "timestamps": stamp, # ((Triforce, 11-28) the default names the place)
|
||||
"assets": {"large_image": logo, "large_text": "Triforce v3.0.0"}},
|
||||
"play": {"details": "Kakariko Village - Adult", "timestamps": stamp,
|
||||
"assets": {"large_image": logo, "large_text": "Triforce v3.0.0 RC7"}},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -71,10 +71,18 @@ def check_source():
|
||||
check(replay.count("rec_parts_by_value.part_submitted(") == 1 and "rec_parts_by_value.submitted(" not in replay,
|
||||
"vk_replay.cpp: the parts are noted somewhere past the registration")
|
||||
|
||||
on = function(replay, "bool rb_rec_end_on() {")
|
||||
check('::mkwvk::wb_rec_wait::rec_end_on(getenv("RX_VK_RB_REC_END"))' in on and "static const bool v" in on,
|
||||
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,
|
||||
"RX_VK_RB_REC_END is not read once through the header's rule")
|
||||
w = function(replay, "bool readback_rec_wait(uint64_t v, int* ok) {")
|
||||
# ((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")
|
||||
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) {")
|
||||
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"),
|
||||
@@ -92,15 +100,15 @@ def check_source():
|
||||
"readback_rec_wait waits on the recordings' timeline before it flushes the held submits: a batched signal never comes")
|
||||
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, int* ok) {")
|
||||
check("return rb_rec_end_on() ? readback_rec_wait(v, ok) : wait_recorded(v, UINT64_MAX, ok);" in both,
|
||||
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)")
|
||||
inv = function(replay, "void invalidate(uint64_t gpu, uint64_t size) {")
|
||||
check(inv.count("readback_recorded_wait(v, &ok)") == 2, "invalidate's two waits by recordings do not both take the rule")
|
||||
check("if (!(unforced && readback_recorded_wait(v, &ok))) {" in inv, "the submitting thread's wait does not take the rule")
|
||||
check("while (completed() < v && !readback_recorded_wait(v, &ok) && async_wait_step(v)) {}" in inv,
|
||||
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")
|
||||
check("while (completed() < v && !readback_recorded_wait(v, host->gpu_guest(gpu), size, &ok) && async_wait_step(v)) {}" in inv,
|
||||
"the replay thread's wait does not take the rule")
|
||||
for needle in ("readback_rec_wait(", "wait_recorded(", "rb_rec_end_on(", "rec_parts_by_value", "st_rb_went_on"):
|
||||
for needle in ("readback_rec_wait(", "wait_recorded(", "rb_rec_end_on(", "rb_rec_end_for(", "memory_rb_cpu_written(", "rec_parts_by_value", "st_rb_went_on"):
|
||||
check(needle not in inv, "invalidate holds %s itself: its branches change invalidate's control-flow hash, and the "
|
||||
"renderer's play profile no longer matches it (keep them in the helpers)" % needle)
|
||||
check("readback_zero_line((long long)presents_now, gpu, size, f0, v, (int)behind0, (int)w);" in inv,
|
||||
@@ -114,7 +122,7 @@ def check_source():
|
||||
"the 3000-readback line does not count the reads that waited past a 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=1` |")]
|
||||
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")
|
||||
|
||||
|
||||
@@ -27,16 +27,16 @@ def main():
|
||||
raise SystemExit("wait_recorded waits without sending the held batch: a batched recording's signal never comes")
|
||||
# ((Triforce, 11-27) invalidate reaches it through readback_recorded_wait, kept out of invalidate for its renderer profile)
|
||||
inv = body(replay, "void invalidate(uint64_t gpu, uint64_t size) {")
|
||||
rrw = body(replay, "bool readback_recorded_wait(uint64_t v, int* ok) {")
|
||||
if "readback_recorded_wait(v, &ok)" not in inv or "wait_recorded(v, UINT64_MAX, ok)" not in rrw:
|
||||
rrw = body(replay, "bool readback_recorded_wait(uint64_t v, uint64_t guest, uint64_t size, int* ok) {")
|
||||
if "readback_recorded_wait(v, host->gpu_guest(gpu), size, &ok)" not in inv or "wait_recorded(v, UINT64_MAX, ok)" not in rrw:
|
||||
raise SystemExit("invalidate's readback wait no longer goes through wait_recorded: update this test")
|
||||
# ((Triforce, 11-27) RX_VK_RB_REC_END: the readback's wait by its own rule, readback_rec_wait, flushes the same way)
|
||||
rb = body(replay, "bool readback_rec_wait(uint64_t v, int* ok) {")
|
||||
rb = body(replay, "bool readback_rec_wait(uint64_t v, uint64_t guest, uint64_t size, int* ok) {")
|
||||
rw = rb[rb.index("int rec_wait(uint64_t seq) {"):]
|
||||
flush = rw.find("queue_flush_for(")
|
||||
if "vkWaitSemaphores(" not in rw or flush < 0 or flush > rw.index("vkWaitSemaphores("):
|
||||
raise SystemExit("readback_rec_wait waits without sending the held batch: a batched recording's signal never comes")
|
||||
if "readback_rec_wait(v, ok)" not in rrw:
|
||||
if "readback_rec_wait(v, guest, size, ok)" not in rrw:
|
||||
raise SystemExit("invalidate's readback wait no longer goes through readback_rec_wait: update this test")
|
||||
print("PASS: wait_recorded and readback_rec_wait send the held batch before they wait")
|
||||
|
||||
|
||||
@@ -81,9 +81,9 @@ MUTATIONS = [
|
||||
" if (false && list_[i].gpu == gpu) return *v = list_[i].v, true;\n", "clean", "values"),
|
||||
("cut", " if (why == tail_early::EARLY && !tail_words()) why = tail_early::EVENT;\n",
|
||||
" if (why == tail_early::EARLY) tail_words();\n", "outside", "values"),
|
||||
("cut", " memory_end_submission(cmd);\n full_barrier(cmd, \"barrier (recording end)\");\n submit_recording(*rec_cur, false, 0, true);",
|
||||
" full_barrier(cmd, \"barrier (recording end)\");\n submit_recording(*rec_cur, false, 0, true);", "clean", "values"),
|
||||
("cut", " tail_words_record(r.upload);", " tail_words_record(r.cmd);", "clean", "order"),
|
||||
("cut", " memory_end_submission(cmd);\n full_barrier(cmd, \"barrier (recording end)\");\n const uint64_t scene_value = rec_cur->value;\n submit_recording(*rec_cur, false, 0, true);",
|
||||
" full_barrier(cmd, \"barrier (recording end)\");\n const uint64_t scene_value = rec_cur->value;\n submit_recording(*rec_cur, false, 0, true);", "clean", "values"),
|
||||
("cut", " tail_words_record(texture_upload_last(r.upload));", " tail_words_record(r.cmd);", "clean", "order"),
|
||||
("cut", " full_barrier(cmd, \"barrier (an event signal in the early tail: its word held)\");\n", "", "clean", "barrier"),
|
||||
("cut", " tl.words.push_back({mirror.buffer, mirror.offset, g.v});\n", "", "clean", "values"),
|
||||
("cut", " gpu_write(r.cmd, g.gpu, &g.v, 4);\n", " (void)g;\n", "written", "values"),
|
||||
|
||||
Reference in New Issue
Block a user