mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 23:49:56 -04:00
Sample terrain with the right mip levels, keep NaNs out of min, max and clamp, and give shadow gathers their own tap offsets.
The runtime's TXD gradient transpose (gfx_shader.c patch_txd_transpose) is off for Switch 2 titles: the SM86 lowering already orders the interleaved derivatives for the translator, so transposing again swapped them back. The translator's float min, max and clamp are the NaN-safe forms (patch 0031), as Maxwell FMNMX and saturate behave, so a NaN no longer spreads through lighting and bloom on drivers that pass it on. Depth-compare gathers with per-tap offsets are split into one gather per tap like the others (patch 0032), where all four taps took the first tap's offset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -800,7 +800,10 @@ out:
|
||||
// builds dx = (first two registers), dy = (last two) = (du/dx, du/dy) and
|
||||
// (dv/dx, dv/dy): a mip level chosen from the wrong derivatives, too sharp on terrain faces turned across the screen,
|
||||
// which crawled in patches that followed the faces. NX2NAVI_TXD_TRANSPOSE=0 turns it off.
|
||||
// Applied to the SPIR-V after it is loaded, so the shader cache is untouched.
|
||||
// Applied to the SPIR-V after it is loaded, so the shader cache is untouched. Not for a Switch 2 title (NVN 200 and up):
|
||||
// its SM86 programs are lowered by tools/xlate/AmpereLowering.cs (Txd), which puts SM86's interleaved derivatives
|
||||
// (dx.x, dy.x, dx.y, dy.y) in the translator's order already, so transposing again here swapped them back and chose
|
||||
// Ocarina's mip levels from the wrong derivatives. NX2NAVI_TXD_TRANSPOSE=1 forces it on.
|
||||
enum { OP_COMPOSITE_CONSTRUCT = 80, OP_SAMPLE_EXPLICIT = 88, IO_GRAD = 4 };
|
||||
|
||||
static void patch_txd_transpose(GfxShader *s) {
|
||||
@@ -808,7 +811,7 @@ static void patch_txd_transpose(GfxShader *s) {
|
||||
static volatile int32_t n_logged;
|
||||
if (on < 0) {
|
||||
const char *e = cfg_get("NX2NAVI_TXD_TRANSPOSE");
|
||||
on = !(e && *e == '0');
|
||||
on = e && *e ? *e != '0' : rt_nvn_api_version[0] < 200;
|
||||
}
|
||||
uint32_t *w = s->spirv;
|
||||
uint64_t n = s->words;
|
||||
|
||||
Reference in New Issue
Block a user