mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 15:09:58 -04:00
Translate every shader, keep atomic loops from spinning on stale values, harden pool teardown, and update the README.
Shaders: a switch whose index is clamped against a register that a MOV of an immediate set before it now finds its jump table (AmpereLowering.cs BrxTargets), so all 36,031 of the game's shader variants translate and no draw is skipped for a failed one. The compare-and-swap loop behind storage-buffer atomics (patch 0033) takes the value a failed swap returns as its next expected value instead of loading the word again, which on some drivers kept returning a stale copy. Memory: an unused physical pool outlives the submission being recorded, as virtual pages may still reach it through device addresses; an image whose creation failed is not tried again for 2 s. The installer and Linux texts name this game. The README has the project icon, the current status, features, requirements and known issues. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1055,16 +1055,38 @@ static int alias_copy(Tex *e, const Tex *src) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Descriptors whose image creation failed (VRAM exhausted, an unsupported format): not tried again for 2 s, so a
|
||||
// draw that names one every frame does not repeat a failing allocation on every use. Texture lock held.
|
||||
#define FAILED_HOLD 32
|
||||
static struct {
|
||||
TexKey k;
|
||||
uint64_t until_ns;
|
||||
} failed_hold[FAILED_HOLD];
|
||||
static unsigned failed_next;
|
||||
|
||||
static int create_held(const TexKey *k) {
|
||||
uint64_t now = plat_now_ns();
|
||||
for (int i = 0; i < FAILED_HOLD; i++)
|
||||
if (failed_hold[i].until_ns > now && !memcmp(&failed_hold[i].k, k, sizeof *k)) return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void create_failed(const TexKey *k) {
|
||||
unsigned i = failed_next++ % FAILED_HOLD;
|
||||
failed_hold[i].k = *k, failed_hold[i].until_ns = plat_now_ns() + 2000000000ull;
|
||||
}
|
||||
|
||||
static Tex *entry_of(const tex_t *t) {
|
||||
TexKey k;
|
||||
make_key(t, &k);
|
||||
Tex *e = nvn_hm_get(&by_key, &k);
|
||||
if (!e) {
|
||||
if (create_held(&k)) return NULL;
|
||||
if (tex_alias < 0) {
|
||||
tex_alias = cfg_bool("NX2NAVI_TEX_ALIAS");
|
||||
rt_log("vk: texture aliases: %s", tex_alias ? "a new image takes the live image's content" : "a new image starts empty");
|
||||
}
|
||||
if (!(e = create_tex(t, &k, tex_alias))) return NULL;
|
||||
if (!(e = create_tex(t, &k, tex_alias))) return create_failed(&k), NULL;
|
||||
perf_count(PERF_CNT_TEX_NEW);
|
||||
// released entries of another descriptor at this address are replaced by the new one; a live one holding
|
||||
// GPU-written content is the alias source, preferring the one that differs only in swizzle (same_but_swizzle)
|
||||
|
||||
Reference in New Issue
Block a user