Commit Graph
5 Commits
Author SHA1 Message Date
MarcelineVQ 55b4931fcb bench: map WoW PE sections for full-fidelity benchmarking, add silicon SSE
Major bench harness upgrade:
- Maps WoW .text (4MB) and .rdata (160KB) at original virtual addresses
  instead of individual function byte arrays. All CALL targets and float
  constants resolve automatically -- no more manual mapGameConstants().
- Bench binary linked at 0x10000000 to avoid address conflict with WoW
  PE sections at 0x400000-0xD00000.

Added silicon_sse.zig: 18 pure math functions extracted from silicon.zig
as export fn (C ABI) for standalone compilation. Covers frustum culling,
bounding volume ops, quaternion slerp, matrix multiplies, trig, etc.

Silicon benchmark results (all 14 new entries pass correctness):
  checkBoxLineIntersect: 3.2x (72->22)  -- slab AABB intersection
  rotateMatByQuat:       3.1x (172->54) -- quat->mat + mat multiply
  quatSlerp:             2.5x (454->178)
  createZRotMat3x3:      2.5x (140->55)
  createRotMat3x4:       2.2x (163->73)
  normalizeVec3InPlace:  1.8x (34->18)
  mulMat3x4InPlace:      1.6x (106->66) -- MISMATCH (layout diff, needs investigation)
  classifyPointFrustum:  1.5x (60->40)
  mulMat3x4:             1.2x (64->52)  -- MISMATCH (same layout issue)

Two MISMATCH entries on mat3x4 multiply -- likely row/column order
difference between original and our implementation. Correctness needs
verification against game behavior.
2026-03-15 12:04:02 -07:00
MarcelineVQ 28dd1cf6fa silicon: implement 32 SSE math replacements for x87 FPU functions
Replace probe-only detours with direct SSE/scalar math implementations
for the highest-impact WoW.exe functions by call frequency:

Core transforms (10.8M+ calls/7.5s):
- transformVector3ByMatrix4x4: @Vector(4,f32) dot products
- transformVector4ByMatrix4x4: 4-row vector dots
- MultiplyMatrix3x4, multiplyMatrix3x3: affine matrix multiply
- MultiplyMatrix3x4InPlace: aliasing-safe with stack temp

Frustum/collision (8.2M+ combined):
- ClassifyPointAgainstFrustum: 6-plane dot + bitmask
- CheckBoxLineIntersection: slab-method AABB test
- TestSphereAgainstFrustum: 6-plane sphere test
- TestOBBAgainstFrustum: 8-corner OBB vs 6 planes
- IsPointInsideBounds: 3-component compare
- CalculateDistanceToPlane: ray-plane intersection

Matrix builders (300K+):
- createAxisAngleRotationMatrix 4x4/3x3/3x4: Rodrigues formula
- createZRotationMatrix3x3: sin/cos rotation
- rotateMatrixByQuaternion: quat→matrix + 4x4 multiply
- getTransposedMatrix4x4: inline transpose
- scaleMatrix3x3ByVector, ApplyTranslationMatrix

Vector/scalar:
- normalizeVector3, NormalizeVector3_InPlace
- Vector3_DotProduct, quaternion_slerp
- addVector3ToAccumulator, addToColorAccumulator
- calculateSinCos

Particle:
- packParticleColorToBytes, setParticleAlphaFromFloat

Bounding volume:
- TranslateBoundingVolume, TransformBoundingVolume

84 functions remain as probe-only (orchestrators, Lua internals,
complex renderers — optimization is in their callees, now replaced).
2026-03-15 11:18:35 -07:00
MarcelineVQ 05e016da46 silicon: fix 5 param count bugs, add periodic probe reporting
Fix calling convention mismatches found via systematic RET purge audit:
- interpolateKeyframes: FC4d→FC3d (3 params, not 4)
- ConvertPixelsToScreenAlt: TC2r→TC2d (returns x87 float, not u32)
- UpdateObjectTransform: FC2r→FC3r (3 params, not 2)
- packParticleColorToBytes: FC4v→FC5v (5 params, not 4)
- setParticleAlphaFromFloat: FC2v→FC3v (3 params, not 2)

Disable GetFPUControlWord probe (corrupts FLDCW state).
Use naked asm for __ftol probe (preserves implicit x87 ST(0)).
Add OnWorldUpdate hook for periodic hit count dumps every ~7.5s.
All 115 active probes verified with non-zero counts in-game.
2026-03-15 03:41:28 -07:00
MarcelineVQ e70015579f silicon: add 116 probe hooks for call-counting all explored functions
Probe infrastructure using comptime probeDetour() that generates
per-function detours: atomic counter increment + callOriginal passthrough.
Hit counts reported on shutdown. Hooks installed at lateInit (engine init),
not DLL load time.

Key findings during decompilation:
- 0x40CF81 is GetFPUControlWord, not ftol (silicon mislabel)
- Real __ftol at 0x40A2B0 (51+ callers, hot path)
- 0x7B7A80/7B7B10 use normal stack floats, not FPU register params
- 0x686640/686820/6868E0 are bounding volume ops, not vector ops
- 0x7786A0 is a UI model constructor, not SetModelLighting
2026-03-15 01:55:09 -07:00
MarcelineVQ 66696e993a silicon: decompile and annotate all ~100 hooked WoW.exe functions
Complete catalog of libSiliconPatch240.dll hook targets with verified
calling conventions, parameter layouts, RET stack cleanup, and functional
descriptions from Ghidra analysis. Zero unknown stubs remain.
2026-03-15 01:22:43 -07:00