Files
NX2navi/runtime/spirv_water.h
chrg6 d31c3a1036 Make the water corrections in the runtime, on by default, instead of loading replacement modules from a folder.
The coordinate pair and the absorption guard needed modules made on each PC by tools/projective_recipe.py and a folder named in NX2NAVI_SPV_OVERRIDE, so no player had them. runtime/spirv_water.c makes the recipe's edits on the translation in memory, in the recipe's order: on the NVIDIA profile its three modules are byte for byte the recipe's (RTX 5090, game 1.1.1). vk_pipeline.c keeps the edited modules in a small table, made at first use, and builds a pair from them only when both of its stages were made; a module of another shape is built as it is, with a log line. NX2NAVI_WATER_PROJECTIVE=0 turns the corrections off. tests/water_projective_check.py compares the runtime's edits with the recipe's on made-up modules.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-12 07:55:57 -05:00

15 lines
1.1 KiB
C

// The water corrections of docs/water-projective.md as edits of a SPIR-V module in memory (spirv_water.c); the same
// edits tools/projective_recipe.py makes on files. vk_pipeline.c applies them to the exact translations it knows.
#pragma once
#include <stdint.h>
// Each returns a new module (free it) with its word count in *out_n, or NULL when the module is not of the shape the
// edit expects; the caller then keeps the original.
// vertex: the location 0 output gets (clip x, clip y, clip w, 1) of the position the stage wrote, before its return.
uint32_t *spirv_water_vertex(const uint32_t *w, uint64_t n, uint64_t *out_n);
// fragment: the location 0 input loses NoPerspective and is read through a local holding (x / w * 0.5 + 0.5,
// y / w * -0.5 + 0.5, 0, 1), which is what the vertex stage wrote there before, now divided per fragment.
uint32_t *spirv_water_fragment(const uint32_t *w, uint64_t n, uint64_t *out_n);
// absorption: the store of id `distance` through id `pointer` stores NMax(distance, 0) instead.
uint32_t *spirv_water_absorption(const uint32_t *w, uint64_t n, uint32_t pointer, uint32_t distance, uint64_t *out_n);