bone_sse: replace matMul/ftol/vec3SqMag with pure Zig, fix visual artifacts
Root cause of billboard visual artifacts: callVec3SqMag used inline asm to call game's x87 vec3SqMag (0x4549F0) with fstps to capture ST0. With SSE2 codegen, the x87/SSE state interaction caused corrupted float values in billboard bone matrices (mat[0][2] wildly wrong). Replaced with pure Zig: x*x + y*y + z*z — no x87, no inline asm. Also replaced: - matMul (0x74A7C0): pure Zig f64 scalar matmul, no alignment needs - callFtol (0x40A2B0): f64 intermediate + @intFromFloat (cvttsd2si) Architecture: bone_sse.zig is REF code compiled with SSE2, called as cdecl from thiscall wrapper in transform44.zig (cross-object to prevent LLVM inlining AND ESP alignment into thiscall frame). A/B: other hooks gated behind AB_OTHER_HOOKS=false for isolated testing.
This commit is contained in:
@@ -67,7 +67,7 @@ pub fn build(b: *std.Build) void {
|
||||
.cpu_arch = .x86,
|
||||
.os_tag = .windows,
|
||||
.abi = .msvc,
|
||||
.cpu_features_add = std.Target.x86.featureSet(&.{ .sse, .sse2, .sse3, .sse4_1, .fma, .avx }),
|
||||
.cpu_features_add = std.Target.x86.featureSet(&.{ .sse, .sse2 }),
|
||||
});
|
||||
const bone_sse_obj = b.addObject(.{
|
||||
.name = "bone_sse",
|
||||
|
||||
Reference in New Issue
Block a user