mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 06:09:58 -04:00
Give mesh output components outside the program's output map Maxwell's default of (0, 0, 0, 1).
A mesh program's header lists the components of each output vector it has; the fragment stage may read the others. The native mesh entry function never wrote them, so they read as whatever the output held, and the fallback's vertex stage wrote 0 for all of them, w included. Maxwell gives an unwritten component (0, 0, 0, 1), as the pipeline code already pads a missing vertex output. Both paths now write that default: MeshSpirv.cs after copying each vertex's lines, mesh_fb.c meshfb_vs with w as the bits of 1.0f whatever the type. Checked: all 520 task and mesh programs of an installed shader cache translate and pass spirv-val (vulkan1.3); 500 mesh modules gained about 730 bytes each on average, so many of the game's mesh programs have partly listed vectors. --probe-meshfb passes (fallback pictures equal the mesh pipeline's), and its module part converts all 520 new translations with 0 failures, all 1,020 modules pass spirv-val and their compute pipelines build. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -306,6 +306,9 @@ static class MeshSpirv
|
||||
// outputs
|
||||
uint tV4 = Ty(OpTypeVector, tFloat, 4);
|
||||
uint pOutFloat = Ptr(ScOutput, tFloat);
|
||||
uint fZero = Id(), fOne = Id();
|
||||
globals.Add(new Insn(OpConstant, new[] { tFloat, fZero, 0u }));
|
||||
globals.Add(new Insn(OpConstant, new[] { tFloat, fOne, 0x3f800000u }));
|
||||
uint posVar = 0, sizeVar = 0;
|
||||
var generic = new Dictionary<int, uint>();
|
||||
foreach (int a in m.Lines)
|
||||
@@ -343,6 +346,16 @@ static class MeshSpirv
|
||||
uint ptr = comp == uint.MaxValue ? Emit(OpAccessChain, pOutFloat, var, v) : Emit(OpAccessChain, pOutFloat, var, v, C(comp));
|
||||
Do(OpStore, ptr, value);
|
||||
}
|
||||
// A component of an output vector that the program's output map leaves out reads as Maxwell gives an
|
||||
// unwritten one, (0, 0, 0, 1), instead of whatever the output held.
|
||||
void Defaults(uint var, int first)
|
||||
{
|
||||
for (int k = 0; k < 4; k++)
|
||||
if (!m.Lines.Contains(first + 4 * k))
|
||||
Do(OpStore, Emit(OpAccessChain, pOutFloat, var, v, C((uint)k)), k == 3 ? fOne : fZero);
|
||||
}
|
||||
if (posVar != 0) Defaults(posVar, 0x70);
|
||||
foreach (var (g, var) in generic) Defaults(var, 0x80 + 16 * g);
|
||||
});
|
||||
}
|
||||
for (int k = 0; k * threads < maxP; k++)
|
||||
|
||||
Reference in New Issue
Block a user