Port Ocarina of Time (Switch 2) to the recomp host

The NVN2 front end and the SM86 to Maxwell shader lowering (tools/xlate/AmpereLowering.cs, mesh and task stages,
bindless texture pools, BRX jump tables, the NVN2 compute c0 layout) with four translator patches (0017-0020) bring the
opening of the game to 58-60 fps on the Vulkan renderer.

This round fixes the haze: SM86 IPA is lowered as a plain Maxwell IPA.PASS (texture coordinates were corrected for
perspective twice); LDSM, TXD, both F2IP byte forms, HMMA, MOVM and HFMA2.RELU are lowered and spill mode has eight
uniform register groups; conditional rendering keeps the newest counter report per address and treats a report as
pending until its value is in guest memory, so occlusion tests and the depth clears around the depth copy behave; and
the upscaler stand-in decodes the post pass's sRGB picture before writing the linear target. Tensor-core programs keep
the stand-in unless NX2NAVI_NATIVE_TENSOR=1, because their lowering does not match the hardware yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
chrg6
2026-11-06 03:03:08 -05:00
parent 0478c13e45
commit 77d0c0b84e
65 changed files with 8136 additions and 554 deletions

View File

@@ -513,3 +513,51 @@ HOST_OVERRIDE("_ZN2nn3hid6detail22GetSixAxisSensorStatesEPiPNS0_18SixAxisSensorS
ov_six_states);
HOST_OVERRIDE("_ZN2nn3hid6detail21GetSixAxisSensorStateEPNS0_18SixAxisSensorStateERKNS0_19SixAxisSensorHandleE",
ov_six_state);
// ---- the public wrappers a Switch 2 title imports. NX2NAVI imports nn::hid::detail::*; Switch 2 titles import the
// public functions, whose direct calls into detail:: no override reaches, so each public one is answered here with
// the detail implementation above. Joy-Con 2 mouse (Nmouse), Jcms and sensor fusion have no host device: no
// handles, starts that do nothing.
// void StartSixAxisSensor(const SixAxisSensorHandle &) / void StopSixAxisSensor(...)
static void ov_pub_six_start(Cpu *c) { ov_six_start(c); }
// int GetSixAxisSensorStates(SixAxisSensorState *out, int count, const SixAxisSensorHandle &): the count filled
static void ov_pub_six_states(Cpu *c) {
ret_x(c, (uint64_t)(int64_t)six_fill(arg_p(c, 0), (int)arg_x(c, 1), arg_p(c, 2), "GetSixAxisSensorStates"));
}
// void SetGyroscopeZeroDriftMode(const SixAxisSensorHandle &, const GyroscopeZeroDriftMode &): the host gyro has
// its own calibration
static void ov_pub_nothing(Cpu *c) { ret_x(c, 0); }
// void InitializeVibrationDevice(const VibrationDeviceHandle &) / void SendVibrationValue(handle, value)
static void ov_pub_vib_init(Cpu *c) { ov_vib_init(c); }
static void ov_pub_vib_send(Cpu *c) { ov_vib_send(c); }
// bool IsOunceVibrationDeviceMounted(const VibrationDeviceHandle &): Ounce is the Switch 2's own actuator; the
// host's rumble devices count as mounted
static void ov_pub_vib_ounce_mounted(Cpu *c) {
ret_x(c, vibration_side(arg_p(c, 0), "IsOunceVibrationDeviceMounted") >= 0);
}
// int GetSensorFusionHandles(...) / int GetNmouseHandles(NmouseHandle *, int, uint32_t): none
static void ov_pub_no_handles(Cpu *c) { ret_x(c, 0); }
// void GetNmouseTypeSet(BitFlagSet<32, NmouseType> *out, NmouseHandle): empty
static void ov_pub_nmouse_types(Cpu *c) {
uint32_t *out = arg_p(c, 0);
if (out) *out = 0;
}
HOST_OVERRIDE("_ZN2nn3hid18StartSixAxisSensorERKNS0_19SixAxisSensorHandleE", ov_pub_six_start);
HOST_OVERRIDE("_ZN2nn3hid22GetSixAxisSensorStatesEPNS0_18SixAxisSensorStateEiRKNS0_19SixAxisSensorHandleE",
ov_pub_six_states);
HOST_OVERRIDE("_ZN2nn3hid25SetGyroscopeZeroDriftModeERKNS0_19SixAxisSensorHandleERKNS0_22GyroscopeZeroDriftModeE",
ov_pub_nothing);
HOST_OVERRIDE("_ZN2nn3hid25InitializeVibrationDeviceERKNS0_21VibrationDeviceHandleE", ov_pub_vib_init);
HOST_OVERRIDE("_ZN2nn3hid18SendVibrationValueERKNS0_21VibrationDeviceHandleERKNS0_14VibrationValueE", ov_pub_vib_send);
HOST_OVERRIDE("_ZN2nn3hid29IsOunceVibrationDeviceMountedERKNS0_21VibrationDeviceHandleE", ov_pub_vib_ounce_mounted);
HOST_OVERRIDE("_ZN2nn3hid22GetSensorFusionHandlesEPNS0_18SensorFusionHandleEiRKjNS_4util10BitFlagSetILi32ENS0_"
"12NpadStyleTagEEE", ov_pub_no_handles);
HOST_OVERRIDE("_ZN2nn3hid20FinalizeSensorFusionEv", ov_pub_nothing);
HOST_OVERRIDE("_ZN2nn3hid16GetNmouseHandlesEPNS0_12NmouseHandleEij", ov_pub_no_handles);
HOST_OVERRIDE("_ZN2nn3hid16GetNmouseTypeSetEPNS_4util10BitFlagSetILi32ENS0_10NmouseTypeEEENS0_12NmouseHandleE",
ov_pub_nmouse_types);
HOST_OVERRIDE("_ZN2nn3hid14FinalizeNmouseEv", ov_pub_nothing);
HOST_OVERRIDE("_ZN2nn3hid13GetJcmsHandleERKjRKNS0_8JcmsTypeE", ov_pub_nothing);
HOST_OVERRIDE("_ZN2nn3hid9StartJcmsERKNS0_10JcmsHandleE", ov_pub_nothing);
HOST_OVERRIDE("_ZN2nn3hid8StopJcmsERKNS0_10JcmsHandleE", ov_pub_nothing);
HOST_OVERRIDE("_ZN2nn3hid12FinalizeJcmsEv", ov_pub_nothing);