Gfx GX Fn GXLoadPosMtxImm - wowjinxy/libPorpoise GitHub Wiki

GXLoadPosMtxImm

  • Category: Transformation and Matrix
  • Matrix Status: Implemented
  • Matrix Notes: Verified 3x4 row-major load into PN matrix slot; tightened to documented GXPosNrmMtx IDs.
  • 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/Transform/GXLoadPosMtxImm.html and SDK source in reference/gx/GXTransform.c.
  • Runtime checked in src/gx/pc_gx.c:
    • Accepts mtx pointer + matrix id, then copies 12 floats (3x4 row-major) into the selected position matrix slot.
    • Marks modelview state dirty so subsequent draws consume updated matrix.
    • Uses slot mapping for GXPosNrmMtx IDs (GX_PNMTX0..GX_PNMTX9 style IDs).
  • Note on SDK nuance:
    • SDK source comments indicate custom IDs may be used in hardware register space, but manual/API names accepted IDs via GXPosNrmMtx.
    • Current PC backend intentionally tracks the documented PN matrix set only (10 slots), which matches common game/demo usage.