mirror of
https://git.triforceproject.com/triforce/source
synced 2026-12-01 05:18:50 -04:00
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:
@@ -29,6 +29,7 @@ struct Gpu {
|
||||
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)
|
||||
int range_part = -1; // ((11-29) the part (its index) whose submit makes the range known: its write-back copied it)
|
||||
|
||||
void submit_up_to(size_t n) {
|
||||
for (; sent < n && sent < parts.size(); sent++) note(sent);
|
||||
@@ -36,6 +37,7 @@ struct Gpu {
|
||||
void note(size_t i) {
|
||||
table.submitted(value, parts[i], i + 1 == parts.size());
|
||||
if (!first_noted) first_noted = parts[i];
|
||||
if ((int)i == range_part) range = parts[i];
|
||||
}
|
||||
void begin() {
|
||||
for (size_t i = 0; i < sent; i++) note(i);
|
||||
@@ -97,6 +99,20 @@ int main() {
|
||||
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));
|
||||
// ((11-29) mode 3: mode 2's rule for the CPU-written ranges, and the read-only ranges at their part (range_applies))
|
||||
CHECK("mode 3", wr::rec_end_mode("3") == wr::kRecEndRange && wr::rec_end_on("3"));
|
||||
// ((11-29, the owner's decision) the reader's default where the parts end at the game's render passes: unset or empty alone
|
||||
CHECK("unset with the pass-end parts: 3", wr::rec_end_mode(nullptr, wr::kRecEndRange) == wr::kRecEndRange
|
||||
&& wr::rec_end_mode("", wr::kRecEndRange) == wr::kRecEndRange);
|
||||
CHECK("set with the pass-end parts: as set", wr::rec_end_mode("2", wr::kRecEndRange) == wr::kRecEndCpuWritten
|
||||
&& wr::rec_end_mode("0", wr::kRecEndRange) == wr::kRecEndOff
|
||||
&& wr::rec_end_mode("1", wr::kRecEndRange) == wr::kRecEndAll
|
||||
&& wr::rec_end_mode("7", wr::kRecEndRange) == wr::kRecEndCpuWritten);
|
||||
CHECK("mode 3, the CPU writes it: the rule", wr::rec_end_applies(wr::kRecEndRange, true) && !wr::range_applies(wr::kRecEndRange, true));
|
||||
CHECK("mode 3, the CPU only reads it: its range's part",
|
||||
!wr::rec_end_applies(wr::kRecEndRange, false) && wr::range_applies(wr::kRecEndRange, false));
|
||||
CHECK("the range's part in mode 3 alone", !wr::range_applies(wr::kRecEndCpuWritten, false) && !wr::range_applies(wr::kRecEndAll, false)
|
||||
&& !wr::range_applies(wr::kRecEndOff, false));
|
||||
|
||||
// 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
|
||||
@@ -318,5 +334,111 @@ int main() {
|
||||
CHECK("random: the old wait ended early at every one of them", old_early == cases_going_on);
|
||||
std::printf("readback rec end: %d of 20000 reads came before their recording's end; the old wait ended early at all %d\n",
|
||||
cases_going_on, old_early);
|
||||
|
||||
// ((11-29) RX_VK_RB_REC_END=3, readback_range_wait: a range the CPU only reads waits for the part that copied it back. The
|
||||
// flicker's case: parts end at the game's render passes, the first after ~32 draws; the read comes after the first part's
|
||||
// submit, its range copied back by the second. The first part's wait read it a frame late (the exposure moved for 15 presents)
|
||||
{
|
||||
Gpu g, g0;
|
||||
g.parts = {10, 11, 12};
|
||||
g.range_part = 1;
|
||||
g0 = g;
|
||||
g.begin(), g0.begin();
|
||||
const wr::ReadbackWait r = wr::readback_range_wait(g);
|
||||
CHECK("range: known and done", r.known && r.ok);
|
||||
CHECK("range: ends at the part that copied it back, not the first, not the last", g.rec_done == 11 && g.hangs == 0);
|
||||
const wr::ReadbackWait r0 = wr::readback_wait(false, g0);
|
||||
CHECK("range: the first part's wait ended before it (the frame-late read)", r0.known && g0.rec_done == 10);
|
||||
}
|
||||
{ // the range's part submitted already: one wait, for it, nothing sliced
|
||||
Gpu g;
|
||||
g.parts = {10, 11, 12};
|
||||
g.sent = 2;
|
||||
g.range_part = 0;
|
||||
g.begin();
|
||||
const wr::ReadbackWait r = wr::readback_range_wait(g);
|
||||
CHECK("range known: one wait, for its part", r.known && r.ok && !r.went_on && g.rec_waits == 1 && g.rec_done == 10 && g.slices == 0);
|
||||
}
|
||||
{ // no part copies the range back: the recording's end, as the last-part rule
|
||||
Gpu g;
|
||||
g.parts = {10, 11, 12};
|
||||
g.begin();
|
||||
const wr::ReadbackWait r = wr::readback_range_wait(g);
|
||||
CHECK("range never copied: the last part", r.known && r.ok && r.went_on && g.rec_done == 12 && g.hangs == 0);
|
||||
}
|
||||
{ // an ended recording whose range no part noted (its runs dropped once done): one wait, for the last part
|
||||
Gpu g;
|
||||
g.parts = {10, 11, 12};
|
||||
g.sent = 3;
|
||||
g.begin();
|
||||
const wr::ReadbackWait r = wr::readback_range_wait(g);
|
||||
CHECK("ended, range not noted: one wait", r.known && r.ok && !r.went_on && g.rec_waits == 1 && g.rec_done == 12);
|
||||
}
|
||||
{ // the parts not known, the first part is (value_rec): that, as before
|
||||
Gpu g;
|
||||
g.parts = {10, 11};
|
||||
g.first_noted = 10;
|
||||
const wr::ReadbackWait r = wr::readback_range_wait(g);
|
||||
CHECK("parts not known: the first part", r.known && r.ok && g.rec_waits == 1 && g.rec_done == 10);
|
||||
Gpu n;
|
||||
n.parts = {10, 11};
|
||||
const wr::ReadbackWait rn = wr::readback_range_wait(n);
|
||||
CHECK("not known at all: the fallback's", !rn.known && n.rec_waits == 0);
|
||||
}
|
||||
{ // the replay stuck before the range's part: slices of the submissions' timeline, ended once it reaches the value
|
||||
Gpu g;
|
||||
g.parts = {10, 11, 12};
|
||||
g.range_part = 2;
|
||||
g.step = 0;
|
||||
g.timeline_after = 4;
|
||||
g.begin();
|
||||
const wr::ReadbackWait r = wr::readback_range_wait(g);
|
||||
CHECK("range, stuck: ended by the timeline", r.known && r.ok && r.went_on && r.slices == 4 && g.timeline_at_v && g.hangs == 0);
|
||||
}
|
||||
{ // an error ends it, not done
|
||||
Gpu g;
|
||||
g.parts = {10, 11, 12};
|
||||
g.range_part = 1;
|
||||
g.rec_wait_error_at = 0;
|
||||
g.begin();
|
||||
const wr::ReadbackWait r = wr::readback_range_wait(g);
|
||||
CHECK("range, error: not done", r.known && !r.ok && g.rec_waits == 1);
|
||||
}
|
||||
// 20,000 random recordings, the range copied back by one of the parts or by none: never back before the range's part is done
|
||||
// (none: the last part), never past it but for the timeline, never a wait for a part not submitted, one wait when its part was
|
||||
// submitted before the read; the first part's wait read it early whenever a later part copied it
|
||||
int range_later = 0, first_early = 0;
|
||||
for (int k = 0; k < 20000; k++) {
|
||||
Gpu g, g0;
|
||||
const size_t n = 1 + rng() % 8;
|
||||
uint64_t s = 5000000 + (uint64_t)k * 16;
|
||||
for (size_t i = 0; i < n; i++) g.parts.push_back(s++);
|
||||
g.sent = 1 + rng() % n;
|
||||
g.step = (int)(rng() % 4);
|
||||
if (g.step == 0) g.timeline_after = 1 + (int)(rng() % 20);
|
||||
g.range_part = (int)(rng() % (n + 1)) - 1;
|
||||
g0 = g;
|
||||
g.begin(), g0.begin();
|
||||
const size_t sent0 = g.sent;
|
||||
const wr::ReadbackWait r = wr::readback_range_wait(g);
|
||||
CHECK("range random: known and done", r.known && r.ok);
|
||||
CHECK("range random: never a wait for a part not submitted", g.hangs == 0);
|
||||
CHECK("range random: waits bounded", g.rec_waits <= (int)n + 1);
|
||||
const uint64_t want = g.range_part < 0 ? g.parts.back() : g.parts[(size_t)g.range_part];
|
||||
CHECK("range random: never before the range's part is done", g.rec_done >= want || g.timeline_at_v);
|
||||
CHECK("range random: never past it but for the timeline", g.rec_done == want || g.timeline_at_v);
|
||||
if (g.range_part >= 0 && (size_t)g.range_part < sent0)
|
||||
CHECK("range random: its part submitted before the read: one wait", g.rec_waits == 1 && !r.went_on && g.slices == 0);
|
||||
const wr::ReadbackWait r0 = wr::readback_wait(false, g0);
|
||||
CHECK("range random old: known", r0.known && r0.ok);
|
||||
if (g.range_part > 0) {
|
||||
range_later++;
|
||||
if (g0.rec_done < want) first_early++;
|
||||
}
|
||||
}
|
||||
CHECK("range random: ranges a later part copied were many", range_later > 5000);
|
||||
CHECK("range random: the first part's wait read every one of them early", first_early == range_later);
|
||||
std::printf("readback range wait: %d of 20000 ranges were copied back after the first part; the first part's wait read all %d early\n",
|
||||
range_later, first_early);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user