Triforce v0.8.5

A Randomizer page in the launcher, a new title screen with Mods and Save Select tabs, scaling changes applied in game, the Jabu-Jabu bars fixed, renderer frame-time work and the brightness-flash fix, and fixes from the 0.8.4 reports.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-28 10:54:41 -06:00
parent 2df08c751e
commit b527e29adb
203 changed files with 18821 additions and 2051 deletions

View File

@@ -19,6 +19,7 @@
#include <tuple>
#include <unordered_map>
#include <vector>
#include "tpltable.h" // ((Triforce, 11-26, C31) the templates' per-thread table, as vk_draw.cpp includes it)
#define CHECK(x) do { if (!(x)) { std::fprintf(stderr, "FAIL:%d %s\n", __LINE__, #x); std::exit(1); } } while (0)
@@ -27,9 +28,16 @@ std::string test;
const char* getenv(const char* name) {
if (!std::strcmp(name, "RX_VK_DESC_SET_KEEP") && test == "keep-off") return "0";
if (!std::strcmp(name, "RX_VK_DESC_TEMPLATE") && (test == "template-off" || test == "push-template-off")) return "0";
if (!std::strcmp(name, "RX_VK_TPL_TABLE") && (test == "tpl-table-off" || test == "push-template-old")) return "0";
if (!std::strcmp(name, "RX_VK_TPL_TABLE") && test == "tpl-table-check") return "2";
return nullptr;
}
void logf(const char*, ...) {}
namespace tpltable = ::mkwvk::tpltable;
std::string lab_knob; // ((Triforce, 11-26, C31) the lab's knob on in this phase: none
namespace lab_ab {
bool on(const char* name) { return lab_knob == name; }
} // namespace lab_ab
#define TLS_OBJECT(name, ...) inline __VA_ARGS__& name() { static thread_local __VA_ARGS__ v; return v; }
template <class T> T handle(uintptr_t v) { return reinterpret_cast<T>(v); }
@@ -358,6 +366,15 @@ int run() {
CHECK(pushes == 0 && st_push_tpl.load() == 5);
return 0;
}
if (test == "push-template-old") { // ((Triforce, 11-26, C31) RX_VK_TPL_TABLE=0: the 8 entries, their layout check on what they find)
prog.push = true;
CHECK(bind_descriptors(cmd, G, prog) && tpl_pushes == 1 && tpl_made == 1 && held(cmd, 0) == expected());
CHECK(bind_descriptors(cmd2, G, prog) && tpl_pushes == 2 && tpl_made == 1 && held(cmd2, 0) == expected()); // (found in the 8)
prog.layout = handle<VkPipelineLayout>(0x120); // (the program's layout made again: found, not its layout, so a new template)
CHECK(bind_descriptors(cmd, G, prog) && tpl_pushes == 3 && tpl_made == 2 && tpls_made.rbegin()->second.pipe_layout == prog.layout);
CHECK(st_tpl_locked.load() == 2 && st_tpl_fast.load() == 1 && pushes == 0);
return 0;
}
if (test == "push-template-off") { // (RX_VK_DESC_TEMPLATE=0: the write structs, as before)
prog.push = true;
CHECK(bind_descriptors(cmd, G, prog) && pushes == 1 && tpl_pushes == 0 && tpl_made == 0 && held(cmd, 0) == expected());
@@ -382,6 +399,68 @@ int run() {
CHECK(bind_descriptors(cmd2, G, other) && pushes == 3 && tpl_tries == 2); // (not tried again at every push)
return 0;
}
if (test == "tpl-table" || test == "tpl-table-off" || test == "tpl-table-check") {
// ((Triforce, 11-26, C31; tpltable.h) 40 programs' whole pushes in turn, three times: each program's template is made once
// and found in the thread's table from then on, tpl_mu taken once a program; by the 8 entries before, at most lookups)
static Program many[40];
for (int i = 0; i < 40; i++)
many[i].key = 0x7000 + i, many[i].push = true, many[i].layout = handle<VkPipelineLayout>(0x1000 + i),
many[i].set_layout = handle<VkDescriptorSetLayout>(0x2000 + i);
for (int round = 0; round < 3; round++)
for (int i = 0; i < 40; i++) {
bufs[0].offset = 64 * (round * 40 + i);
CHECK(bind_descriptors(cmd, G, many[i]) && held(cmd, 0) == expected());
CHECK(tpls_made.at(handle<VkDescriptorUpdateTemplate>(0x5000 + i + 1)).pipe_layout == many[i].layout);
}
CHECK(tpl_pushes == 120 && tpl_made == 40 && pushes == 0); // (each through its own template, whichever table)
CHECK(st_tpl_fast.load() + st_tpl_locked.load() == 120);
if (test == "tpl-table-off") { // (RX_VK_TPL_TABLE=0: the 8 entries, as before)
CHECK(st_tpl_locked.load() > 80 && st_tpl_checked.load() == 0);
return 0;
}
CHECK(st_tpl_locked.load() == 40 && st_tpl_fast.load() == 80);
CHECK(st_tpl_checked.load() == (test == "tpl-table-check" ? 80 : 0) && st_tpl_bad.load() == 0); // (=2: each find is the map's)
many[3].layout = handle<VkPipelineLayout>(0x1F00); // (a layout made again: found, not its layout, so the lock and a new template)
CHECK(bind_descriptors(cmd, G, many[3]) && tpl_made == 41 && st_tpl_locked.load() == 41);
CHECK(tpls_made.rbegin()->second.pipe_layout == many[3].layout);
CHECK(bind_descriptors(cmd, G, many[4]) && bind_descriptors(cmd, G, many[3]) && tpl_made == 41 && st_tpl_locked.load() == 41);
CHECK(st_tpl_bad.load() == 0);
lab_knob = "notpltable"; // (the lab's phase: the 8 entries, the same templates)
for (int i = 0; i < 40; i++) CHECK(bind_descriptors(cmd, G, many[i]) && held(cmd, 0) == expected());
CHECK(st_tpl_locked.load() > 41 + 20 && tpl_made == 41);
lab_knob.clear(); // (and back: the table still holds them)
const int64_t locked = st_tpl_locked.load();
for (int i = 0; i < 40; i++) CHECK(bind_descriptors(cmd, G, many[i]) && held(cmd, 0) == expected());
CHECK(st_tpl_locked.load() == locked && tpl_made == 41 && pushes == 0);
// (a program over the push limit: its set template is found the same way, and used only while its set layout is the program's)
Program over;
over.key = 0x7100, over.layout = handle<VkPipelineLayout>(0x1100), over.set_layout = handle<VkDescriptorSetLayout>(0x2100);
bufs[0].offset = 0x8000;
bind(G, cmd, over);
CHECK(tpl_made == 42 && st_tpl_locked.load() == locked + 1 && tpls_made.rbegin()->second.layout == over.set_layout);
bufs[0].offset = 0x8040; // (other descriptors: a new set, written through the template the table finds)
bind(G, cmd, over);
CHECK(tpl_made == 42 && st_tpl_locked.load() == locked + 1 && tpl_updates == 2);
over.set_layout = handle<VkDescriptorSetLayout>(0x2180); // (its set layout made again: found, not its layout, so the lock and a new template)
bufs[0].offset = 0x8080;
bind(G, cmd, over);
CHECK(tpl_made == 43 && st_tpl_locked.load() == locked + 2 && tpls_made.rbegin()->second.layout == over.set_layout);
CHECK(st_tpl_bad.load() == 0);
if (test == "tpl-table-check") { // (an entry that is not the map's, put in the thread's table: the check counts it)
const SetTemplate* real = nullptr;
{
std::lock_guard lk(tpl_mu);
real = push_tpls[0].at(&many[5]).get();
}
static SetTemplate planted;
planted = *real; // (the same template and layouts, at another address: not what the map holds)
tpl_wide().put(tpltable::key_of(&many[5], tpltable::kPushGraphics), &planted);
bufs[0].offset = 0x9000;
CHECK(bind_descriptors(cmd, G, many[5]) && held(cmd, 0) == expected());
CHECK(st_tpl_bad.load() == 1);
}
return 0;
}
std::fprintf(stderr, "no case %s\n", test.c_str());
return 2;
}