perf: SSE frustum culling -- AABB test, 8-corner occlusion, behind-camera fix
Hook 0x686940 (testAABBFrustum): SSE center/extent P-vertex method replaces x87 sign-bit corner selection. ~160M cycles in profile, 50% rejection rate. Hook 0x686180 (FrustumCullBoundingBox 8-corner): SSE replacement transforms all 8 AABB corners through view-proj, horizon buffer scan with 4-wide test. Fix behind-camera bug in both FrustumCullBoundingBox variants (0x686000, 0x686180): original returned 0 for behind-camera objects, callers interpret 0 as "visible, render it". Now returns 2 (occluded) when all geometry is behind the camera (Z < 0 in clip space).
This commit is contained in:
@@ -260,6 +260,8 @@ fn installPatches() u32 {
|
||||
.{ .target = 0x686820, .replacement = @intFromPtr(&sse.si_translateBoundingVol), .name = "translateBoundingVol" },
|
||||
.{ .target = 0x6ABC40, .replacement = @intFromPtr(&sse.si_processLinkedListCollision), .name = "processLinkedListCollision" },
|
||||
.{ .target = 0x686000, .replacement = @intFromPtr(&sse.si_frustumCullBBox), .name = "frustumCullBBox" },
|
||||
.{ .target = 0x686180, .replacement = @intFromPtr(&sse.si_frustumCullBBox8), .name = "frustumCullBBox8" },
|
||||
.{ .target = 0x686940, .replacement = @intFromPtr(&sse.si_testAABBFrustum), .name = "testAABBFrustum" },
|
||||
.{ .target = 0x6B8C60, .replacement = @intFromPtr(&performSpatialCulling), .name = "PerformSpatialCulling" },
|
||||
.{ .target = 0x6B88E0, .replacement = @intFromPtr(&performCollisionDetectionSSE), .name = "performCollisionDetection" },
|
||||
.{ .target = 0x7C2C40, .replacement = @intFromPtr(&rayTriIntersectIndexedInt), .name = "rayTriIndexedInt" },
|
||||
@@ -277,6 +279,7 @@ fn installPatches() u32 {
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
// =============================================================================
|
||||
// Install / Remove
|
||||
// =============================================================================
|
||||
|
||||
Reference in New Issue
Block a user