perf: FrustumCullBoundingBox SSE replacement, 1.6x speedup

- silicon_sse: si_frustumCullBBox (0x686000) — inline V4 mat*vec3
  transforms, SSE perspective divide, 4-wide horizon buffer scan.
  Benched 1.6x (117→72 cyc/call). Installed via JMP patch (544 bytes,
  won't fit in 380-byte original).
- bench: add frustumCullBBox benchmark with mapped globals, identity
  matrices, and horizon buffer test fixture.
- Remove patch table entry for frustumCullBBox, install via detour hook
  instead (allows future A/B testing if needed).
This commit is contained in:
MarcelineVQ
2026-03-23 20:46:28 -07:00
parent 7819d6d914
commit 035355b757
3 changed files with 189 additions and 0 deletions
+2
View File
@@ -2089,6 +2089,7 @@ const sse = struct {
extern fn si_vec3Dot() callconv(.naked) void;
extern fn si_translateBoundingVol(u32, u32) callconv(TC) void;
extern fn si_processLinkedListCollision(u32, u32, u32, u32) callconv(FC) u32;
extern fn si_frustumCullBBox(u32, u32, u32) callconv(FC) u32;
};
const PatchEntry = struct {
@@ -2124,6 +2125,7 @@ fn getPatchTable() []const PatchEntry {
// vec3Dot (0x602630): removed — 0.6x regression, x87 is optimal for this ABI
.{ .target = 0x686820, .replacement = @intFromPtr(&sse.si_translateBoundingVol), .name = "translateBoundingVol" },
.{ .target = 0x6ABC40, .replacement = @intFromPtr(&sse.si_processLinkedListCollision), .name = "processLinkedListCollision" },
// frustumCullBBox: A/B tested via detour hook, not patched
};
return &table;
}