Gfx GX Fn GXLoadTexMtxImm - wowjinxy/libPorpoise GitHub Wiki

GXLoadTexMtxImm

  • Category: Transformation and Matrix
  • Matrix Status: Partial
  • Matrix Notes: Verified first-pass texture matrix load and corrected GX_MTX2x4 vs GX_MTX3x4 size handling; HW2 post-transform (GX_PTTEXMTX*) path remains unimplemented.
  • 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/GXLoadTexMtxImm.html and SDK source in reference/gx/GXTransform.c.
  • Runtime checked in src/gx/pc_gx.c:
    • Accepts both GX_MTX2x4 and GX_MTX3x4 input forms.
    • GX_MTX2x4: copies first 2 rows and synthesizes row3 as [0,0,0,1] for backend use.
    • GX_MTX3x4: copies full 12 floats directly.
    • Marks texgen state dirty so updated matrix is applied to subsequent draws.
    • Matrix ID mapping currently targets first-pass texture matrices (GX_TEXMTX* / slot IDs); GX_IDENTITY is treated as fixed identity and not writable.
  • Known divergence (keeps status Partial):
    • HW2 post-transform texture matrix IDs (GX_PTTEXMTX*) are not yet mapped/loaded in this backend path.