Gfx GX Fn GXGetLightDirv - wowjinxy/libPorpoise GitHub Wiki

GXGetLightDirv

  • Category: Lighting
  • Matrix Status: Implemented
  • Matrix Notes: Verified macro-only API that forwards to GXGetLightDir with vector component pointers.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Lighting/GXGetLightDirv.html
  • Reference header: reference/gx/GXGet.h
  • SDK behavior:
    • C spec is a macro, not a function symbol:
      • #define GXGetLightDirv(lo, vec) (GXGetLightDir((lo), (f32*)(vec), (f32*)(vec)+1, (f32*)(vec)+2))
    • Writes light direction into vector-compatible storage (f32[3] or compatible struct).
    • No additional GX state side effects beyond GXGetLightDir.

libPorpoise Implementation

  • Public API declaration: include/dolphin/gx/GXGet.h
  • Runtime implementation: macro in header; uses GXGetLightDir implementation in src/gx/pc_gx.c.
  • Behavior:
    • Macro expansion shape matches SDK.
    • There is no standalone GXGetLightDirv runtime symbol (expected).
    • Runtime behavior inherits SDK-compatible sign convention from GXGetLightDir.

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: macro wrapper API.
    • Porpoise: macro wrapper API (same argument mapping).
  • Behavioral parity:
    • SDK: forwards to GXGetLightDir with (vec), (vec)+1, (vec)+2.
    • Porpoise: same forwarding behavior.
  • Known divergence:
    • None for macro contract/expansion shape.
    • Underlying GXGetLightDir constness differs by header flavor (SDK references often use const GXLightObj*; Porpoise public header uses non-const pointer type).

Validation Checklist

  • GX demo coverage checked
  • Pikmin usage path checked
  • Matrix status updated if needed
  • Notes updated with concrete file/function references

Working Notes

  • Confirmed official manual explicitly defines GXGetLightDirv as macro text.
  • Confirmed reference header macro and Porpoise macro use identical pointer arithmetic.