mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 14:39:58 -04:00
Guard float colour outputs against NaN, start mesh counts at zero, and read XInput pads SDL misses.
Patch 0027: a float colour output turns NaN into 0 and clamps the rest to +-1e30 before it reaches its target, so one bad texel cannot spread through bloom, blur and downsample passes as black or white blocks; integer targets keep their bits. Task and mesh shaders start their mesh and primitive counts at 0 behind a barrier, and a task emits at most one mesh group per thread, so a task that culls everything no longer launches what the shared memory last held. Without a gamepad SDL can open, the first connected XInput controller (slots 0-3, empty slots asked once a second) is read directly. Kokiri Forest: 60 fps, GPU 5.5 ms a frame, unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -252,13 +252,20 @@ static class MeshSpirv
|
||||
body.Add(new Insn(OpFunction, new[] { tVoid, entryFn, 0u, tFnVoid }));
|
||||
Label();
|
||||
uint tid = Emit(OpLoad, tUint, lii);
|
||||
if (m.Stage == 7 && m.HasTask) { CopyPayload(tid, true); Barrier(); }
|
||||
// The counts start at 0: a task that culls everything never writes its mesh count, and the word then held what
|
||||
// the workgroup's shared memory last had, up to tens of thousands of mesh groups and a lost device; a mesh
|
||||
// shader that emits nothing leaves its primitive count the same way.
|
||||
uint countWord = C((uint)(m.Stage == 6 ? (m.Pay + 4) / 4 : m.Map / 4));
|
||||
If(tid, C(1), () => Do(OpStore, Emit(OpAccessChain, pSharedUint, sharedVar, countWord), C(0)));
|
||||
if (m.Stage == 7 && m.HasTask) CopyPayload(tid, true);
|
||||
Barrier();
|
||||
Emit(OpFunctionCall, tVoid, mainFn);
|
||||
Barrier();
|
||||
var modes = new List<Insn>();
|
||||
if (m.Stage == 6)
|
||||
{
|
||||
uint count = SharedWord(C((uint)(m.Pay + 4) / 4));
|
||||
// one mesh group per task thread at most: a garbage count cannot launch more than the task could fill
|
||||
uint count = UMin(SharedWord(C((uint)(m.Pay + 4) / 4)), C((uint)Math.Max(1, m.Threads)));
|
||||
CopyPayload(tid, false);
|
||||
Do(OpEmitMeshTasksEXT, count, C(1), C(1), payloadVar);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user