Skip to content

Consolidate mouse-pick FP-mode guard into getPickRay() and correct misleading comments #227

Description

@costin-alupului

Context

Follow-up to #215 / #222 (merged). In the review of #222, @meerzulee raised two points:

  1. 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.

  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions