Gfx GX Fn GXInitLightAttn - wowjinxy/libPorpoise GitHub Wiki

GXInitLightAttn

  • Category: Lighting
  • Matrix Status: Implemented
  • Matrix Notes: Verified SDK-parity coefficient writes for angular (a0..a2) and distance (k0..k2) attenuation fields in the light object.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual root: reference/rvlsdk/man/en_US/gx
  • Primary SDK source area: demos/PikminDemo/src/gx (GC-style Dolphin GX source)
  • Notes:
    • Confirm official signature/prototype
    • Confirm documented side effects (register/state updates)
    • Confirm special behavior and edge cases from manual

libPorpoise Implementation

  • Runtime implementation area: src/gx
  • Public API surface: include/dolphin/gx
  • Notes:
    • Confirm API signature matches SDK
    • Confirm state writes match SDK semantics
    • Confirm backend behavior in PC renderer path

SDK vs Porpoise Diff

  • Signature parity:
    • SDK:
    • Porpoise:
  • Behavioral parity:
    • SDK:
    • Porpoise:
  • Known divergence:

Validation Checklist

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

Working Notes

  • Docs checked against reference/man/gfx/gx/Lighting/GXInitLightAttn.html and SDK source in reference/gx/GXLight.c.
  • SDK behavior:
    • Writes six attenuation coefficients directly into the light object (a[0..2], k[0..2]).
    • No clamping or normalization of coefficient values is applied in this API.
  • Runtime behavior in src/gx/pc_gx.c:
    • GXInitLightAttn writes a0/a1/a2/k0/k1/k2 directly to internal light-object fields with matching ordering.
  • Result:
    • Function semantics match SDK for coefficient initialization.