Gfx GX Fn GXGetLightPosv - wowjinxy/libPorpoise GitHub Wiki

GXGetLightPosv

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

Official SDK (Reference)

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

libPorpoise Implementation

  • Public API declaration: include/dolphin/gx/GXGet.h
  • Runtime implementation: macro in header; uses GXGetLightPos implementation in src/gx/pc_gx.c.
  • Behavior:
    • Macro shape and argument mapping match SDK style.
    • There is no standalone GXGetLightPosv runtime symbol (expected).
    • Backend behavior is inherited from GXGetLightPos and remains getter-only.

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: macro wrapper API.
    • Porpoise: macro wrapper API (same calling form).
  • Behavioral parity:
    • SDK: forwards to GXGetLightPos with (vec), (vec)+1, (vec)+2.
    • Porpoise: same forwarding behavior.
  • Known divergence:
    • None for macro contract/expansion shape.
    • Underlying GXGetLightPos constness differs by header flavor (SDK often 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 page defines macro text directly (not a function prototype).
  • Confirmed reference header macro in reference/gx/GXGet.h matches Porpoise header expansion pattern.