You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The code comments overstate the cause. They state an "audio-thread FP env leak" as fact, but FPU state is per-thread (FPCR on arm64) — an audio thread cannot corrupt the main thread's FP env. The likely cause is audio work on the main thread altering the FP mode (addressed separately in fix(audio): guard FP environment at all audio entry points #226). The guard should be documented as a defensive re-assert, not a proven audio-thread fix.
The guard should live in getPickRay().bugfix: Re-assert FP mode in mouse pick to fix wrong click location with audio active #222 guarded screenToTerrain() and pickDrawable() individually, but getPickRay() is the shared chokepoint also used by screenToWorldAtZ(), calcCameraAreaOffset(), and similar paths in W3DMouse.cpp / W3DTerrainVisual.cpp. Consolidating there covers all callers with a single guard.
Change
Move the single setFPMode() call into getPickRay(); remove the two now-redundant calls in screenToTerrain() / pickDrawable().
Reword the comments to describe a defensive FP-mode re-assert without asserting the audio-thread mechanism.
No behavior change beyond broader, correctly-documented coverage.
Context
Follow-up to #215 / #222 (merged). In the review of #222, @meerzulee raised two points:
The code comments overstate the cause. They state an "audio-thread FP env leak" as fact, but FPU state is per-thread (FPCR on arm64) — an audio thread cannot corrupt the main thread's FP env. The likely cause is audio work on the main thread altering the FP mode (addressed separately in fix(audio): guard FP environment at all audio entry points #226). The guard should be documented as a defensive re-assert, not a proven audio-thread fix.
The guard should live in
getPickRay(). bugfix: Re-assert FP mode in mouse pick to fix wrong click location with audio active #222 guardedscreenToTerrain()andpickDrawable()individually, butgetPickRay()is the shared chokepoint also used byscreenToWorldAtZ(),calcCameraAreaOffset(), and similar paths inW3DMouse.cpp/W3DTerrainVisual.cpp. Consolidating there covers all callers with a single guard.Change
setFPMode()call intogetPickRay(); remove the two now-redundant calls inscreenToTerrain()/pickDrawable().No behavior change beyond broader, correctly-documented coverage.