mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-15 19:19:58 -04:00
Give task and mesh payloads room for the header before the program's data, which stops the white specks in foliage.
The payload size in an NVN2 task or mesh program header counts only the program's own data, which starts after a 24-byte header (the mesh count and two words the mesh program reads). The foliage task writes three 1024-byte arrays from there, up to byte 3096 of a payload sized 3072, so the last entries of the third array were lost and its mesh programs read past the end of their buffer. Those reads came back different on each run, so a few leaves of each dense patch landed in different places in the depth pre-pass and the colour pass, and the colour pass's equal depth test left them unpainted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -185,6 +185,13 @@ static class SwshXlate
|
||||
// carry 0 there while the payload is used (the task writes the mesh count at +4, the mesh reads
|
||||
// ISBERD region 7 at 0x10 and 0x14): a payload under 256 bytes rounds down. One unit covers it.
|
||||
if ((mesh.Stage == 6 || mesh.HasTask) && mesh.PayloadBytes == 0) mesh.PayloadBytes = 256;
|
||||
// The size field counts the program's own data, which starts after the buffer's header (the mesh
|
||||
// count at +4, the words at 0x10 and 0x14): an Ocarina foliage task with a size of 3072 writes
|
||||
// three 1024-byte arrays from 0x18, up to byte 3096. A payload cut at 3072 bytes lost the last
|
||||
// entries of the third array, and its mesh programs read past the end of their buffer there, a
|
||||
// different value on every run: a few leaves of each dense patch moved between the depth pre-pass
|
||||
// and the colour pass and left white specks. The header comes on top, rounded to 16 bytes.
|
||||
if (mesh.Stage == 6 || mesh.HasTask) mesh.PayloadBytes += 0x20;
|
||||
code = AmpereLowering.Lower(code, size, false, out int meshLocal, null, mesh);
|
||||
if (meshLocal != 0) job["local_mem"] = meshLocal;
|
||||
job["local"] = new JsonArray(mesh.Threads, 1, 1);
|
||||
|
||||
Reference in New Issue
Block a user