Triforce v0.5.1

Hotfix for v0.5.0: crashes (NX2navi game folder refused by Setup, heap-full retries, GTX 10 series noise pass and whole VRAM mirrors, code-patch mods kept with their code, no page file warning), graphics (DLSS with frame generation, DLSS coming back, AMD storage buffer alignment, mesh index map, shared memory barrier, shader conversions, integrated GPUs' uniform snapshot, a Mesh shaders row), controls (microphone after restart, button prompts with a mod's size table, sprint vs Hide text, native mouse camera, controller after Restart now), Setup's Preparing shaders step, and the Linux link fix.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-18 12:06:48 -06:00
parent 72793f2231
commit a750a21025
54 changed files with 1806 additions and 114 deletions

View File

@@ -284,6 +284,9 @@ inline LoweredProgram LowerToMaxwellWith(std::span<const Instruction> code, u32
if (!entered)
for (u32 pc = index + 1; pc < target; ++pc) dead_instructions[pc] = true;
}
// (hookshot) A shared memory store (STS) not yet followed by a barrier: an LDS after it may read what another lane of the
// warp stored (see LDS below)
bool shared_store_pending = false;
for (u32 index = 0; index < code.size(); ++index) {
auto insn = code[index];
result.source_instruction_offsets.push_back(static_cast<u32>(result.instructions.size()));
@@ -1701,6 +1704,7 @@ inline LoweredProgram LowerToMaxwellWith(std::span<const Instruction> code, u32
case 0xb1d: // BAR.SYNC 0 (bit 80: .DEFER_BLOCKING), full workgroup.
if (insn.words[1] || (insn.words[2] & ~0x10000U) || native_predicate != 7)
return fail(index, "native workgroup barrier mode");
shared_store_pending = false;
emit(0xf0a8000000000000ULL | predicate | (u64{1} << 43) |
(u64{1} << 44) | (u64{1} << 39) | (u64{7} << 39));
break;
@@ -1757,6 +1761,23 @@ inline LoweredProgram LowerToMaxwellWith(std::span<const Instruction> code, u32
}
const bool store = opcode != 0x984;
const u32 data = store ? insn.Bits(32, 8) : static_cast<u32>(dest);
// (hookshot) A warp stores to shared memory (STS) and reads it back (LDS) with no barrier between: the Switch runs a
// warp's shared memory accesses in order, Vulkan orders another lane's store and this lane's load only through a
// barrier, and the driver's compiler may move them past each other (OoT's 4/3 gameplay network on NVIDIA's cooperative
// matrix path: 16x2 bright bars, Hookshot issue 2455). As for LDSM: a subgroup barrier before the first LDS after an
// STS, only where the LDS is not predicated (every lane of the warp reaches it). RX_VK_SHARED_NO_LDS_BARRIER=1: none, as before
// ((Triforce) both our STS forms, 0x388 and 0x988 with a uniform base, count as the store; the switch read here, as
// this file's others are: upstream's env_on is in a header we do not have)
static const bool lds_barrier = [] {
const char* e = std::getenv("RX_VK_SHARED_NO_LDS_BARRIER");
return !(e && *e && *e != '0');
}();
if (store) {
shared_store_pending = true;
} else if (shared_store_pending && lds_barrier && native_predicate == 7) {
emit(0xef98000000000000ULL | predicate | (u64{1} << 20)); // (MEMBAR, bit 20: barrier_operations.cpp)
shared_store_pending = false;
}
emit((store ? 0xef58000000000000ULL : 0xef48000000000000ULL) |
predicate | data | (u64{address} << 8) | (u64{insn.Bits(40, 24)} << 20) |
(u64{width} << 48));
@@ -1877,6 +1898,9 @@ inline LoweredProgram LowerToMaxwellWith(std::span<const Instruction> code, u32
return fail(index, "native matrix load mode");
u32 address = insn.Bits(24, 8);
const u64 offset = insn.Bits(40, 24);
// (Fritchii f130f0c50; ours had it already) An address the results overwrite is copied first, to R254: the paths below
// use R246-R253, and R253 is where each matrix's row address is shuffled to, so with the copy there matrices 1-3 of
// an .x2/.x4 read matrix 0's rows (OoT has one such LDSM.x4, gpu/vk/tests/ldsm_address_test.cpp)
if (uniform_offset) {
const u32 uniform = uniform_register(insn.Bits(32, 8));
if (uniform == ~0U) return fail(index, "native matrix load uniform offset");