Gfx GX Fn GXSetProjection - wowjinxy/libPorpoise GitHub Wiki

GXSetProjection

  • Category: Transformation and Matrix
  • Matrix Status: Implemented
  • Matrix Notes: Verified doc layout semantics: only p0-p5 are consumed and reconstructed per GX_PERSPECTIVE / GX_ORTHOGRAPHIC.
  • 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/GXSetProjection.html and SDK source in reference/gx/GXTransform.c.
  • Runtime checked in src/gx/pc_gx.c:
    • Accepts matrix + projection type and updates projection state.
    • Uses only p0..p5 layout fields from input matrix, reconstructing implied entries for:
      • GX_PERSPECTIVE: row3 uses -1 in [3][2].
      • GX_ORTHOGRAPHIC: row4 uses 1 in [3][3].
    • Stores normalized type (GX_ORTHOGRAPHIC or fallback GX_PERSPECTIVE) and marks projection dirty.
  • Result: function-level parity is correct for documented matrix-layout semantics; no runtime code changes needed.