Gfx GX Fn GXSetViewportJitter - wowjinxy/libPorpoise GitHub Wiki

GXSetViewportJitter

  • Category: Transformation and Matrix
  • Matrix Status: Implemented
  • Matrix Notes: SDK-parity half-line jitter rule applied (VI_FIELD_BELOW shifts top by -0.5f), with viewport/depth state handled via normal viewport path.
  • 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/GXSetViewportJitter.html and SDK source in reference/gx/GXTransform.c.
  • Runtime updated in src/gx/pc_gx.c:
    • Replaced parity-based jitter approximation with SDK rule:
      • if field == VI_FIELD_BELOW then top -= 0.5f
      • otherwise unchanged
    • Calls GXSetViewport(...) with the adjusted top value to keep shared viewport/depth state flow.
  • Result: function-level parity now matches SDK behavior for jitter offset semantics.