Triforce v0.8.0

Evil HD (SMAA Ultra, 16x filtering, full textures, ambient occlusion with bounce light, sunlight shafts, foliage drawn 4x as far, the remastered texture pack's loader and the launcher's download of it), FSR 3.1 frame generation for every GPU, Intel XeSS, FSR 4 model choice, ReShade presets, Auto (this PC), HUD placement, the options menu in 13 languages, a second input for every control, hold to toggle, DualSense speaker and haptics, NFC from the player's own dumps, the above-60 fps game fixes, the Debug tab's flight and Inventory fixes, the launcher's full settings, and over 250 fixes.
This commit is contained in:
ruckus7382sfgsgdf
2026-11-25 10:21:32 -06:00
parent 861702476a
commit 4fa4f9188b
881 changed files with 179428 additions and 15581 deletions

View File

@@ -6,16 +6,19 @@
// vkQueuePresentKHR. Off is the game as without it: the driver is told Off once, nothing else is called. The extension is
// enabled whenever the device has it, so the row needs no restart: enabled alone it does nothing.
//
// ((Triforce) 11-24) With frame generation on, the frames are shown by its display thread (vk_framegen.cpp display_main), a set
// of made frames and the game's for each game frame, later than the game thread's next input stage. Each set keeps the game
// frame it was made at (antilag_frame), and only the set's game frame gives that frame's present stage (antilag_present_frame);
// the made frames' presents give none. Before, Anti-Lag 2 was off whenever frame generation was on.
//
// As with Reflex, the input stage stands for the game's simulation start only roughly: OoT simulates on its main thread and
// renders on its presentation thread, and the wait holds the presentation thread, which the main thread waits for. With frame
// generation on, presents come from the display thread: Anti-Lag 2 is not used then.
// renders on its presentation thread, and the wait holds the presentation thread, which the main thread waits for.
#include "vk_antilag.h"
#include <cstdlib>
#include <cstring>
#include <mutex>
#include "vk_framegen.h"
#include "vk_menu.h"
namespace mkwvk {
@@ -29,6 +32,8 @@ struct AntiLag {
bool active = false; // (the driver was last told On)
bool frame_marked = false; // (this frame's input stage given: its present stage counts)
uint64_t frame = 0; // (the frame's index, the same for both its stages)
uint64_t since = 0; // ((Triforce) the last index before the row last changed: frames up to it get no present stage)
uint64_t presented = 0; // ((Triforce) the last frame given its present stage by the display thread: once each)
std::mutex mu;
};
AntiLag& al() {
@@ -50,23 +55,23 @@ void update(bool on, const VkAntiLagPresentationInfoAMD* stage) {
al().update(dev.device, &d);
}
/// With a.mu held: the row on, the extension and its feature, and no frame generation (its own display thread). Turning off
/// tells the driver once
/// With a.mu held: the row on, and the extension and its feature (frame generation too, (Triforce) 11-24: the display thread's
/// presents give their set's game frame). Turning off tells the driver once
bool on() {
AntiLag& a = al();
if (!a.ready) return false;
const bool want = wanted() && !framegen_on();
const bool want = wanted();
if (want != a.active) {
if (!want) update(false, nullptr);
a.active = want, a.frame_marked = false;
a.active = want, a.frame_marked = false, a.since = a.frame;
logf("vk: AMD Anti-Lag 2: %s", want ? "on" : "off");
}
return want;
}
void stage(VkAntiLagStageAMD s) {
void stage(VkAntiLagStageAMD s, uint64_t frame) {
VkAntiLagPresentationInfoAMD p{VK_STRUCTURE_TYPE_ANTI_LAG_PRESENTATION_INFO_AMD};
p.stage = s, p.frameIndex = al().frame;
p.stage = s, p.frameIndex = frame;
update(true, &p);
}
@@ -104,11 +109,25 @@ void antilag_device_created() {
bool antilag_available() { return al().ready; }
thread_local uint64_t antilag_present_frame = kAntiLagThisFrame;
uint64_t antilag_frame() {
AntiLag& a = al();
std::lock_guard lk(a.mu);
return on() && a.frame_marked ? a.frame : 0;
}
void antilag_present() {
AntiLag& a = al();
std::lock_guard lk(a.mu);
if (!on() || !a.frame_marked) return;
stage(VK_ANTI_LAG_STAGE_PRESENT_AMD);
const uint64_t f = antilag_present_frame;
if (f == kAntiLagThisFrame) return stage(VK_ANTI_LAG_STAGE_PRESENT_AMD, a.frame); // (the game's own present, as before)
// (frame generation's display thread: its set's game frame, once; a made frame's present, or a frame from before the row
// last changed, none)
if (!f || f <= a.since || f <= a.presented) return;
a.presented = f;
stage(VK_ANTI_LAG_STAGE_PRESENT_AMD, f);
}
void antilag_input() {
@@ -116,7 +135,7 @@ void antilag_input() {
std::lock_guard lk(a.mu);
if (!on()) return;
a.frame++;
stage(VK_ANTI_LAG_STAGE_INPUT_AMD); // (the driver's wait, when it wants one)
stage(VK_ANTI_LAG_STAGE_INPUT_AMD, a.frame); // (the driver's wait, when it wants one)
a.frame_marked = true;
}