Gfx GX Fn GXSetClipMode - wowjinxy/libPorpoise GitHub Wiki

GXSetClipMode

  • Category: Clipping and Culling
  • Matrix Status: Partial
  • Matrix Notes: Clip mode value is tracked and sanitized to SDK enum values; backend intentionally keeps standard clipping (no direct emulation of GX clip-disable 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/Culling/GXSetClipMode.html and SDK source in reference/gx/GXTransform.c.
  • SDK behavior:
    • Writes mode directly to XF clip-disable register (XF_CLIPDISABLE) with GX_CLIP_ENABLE/GX_CLIP_DISABLE.
  • Runtime behavior in src/gx/pc_gx.c:
    • Flushes pending geometry before state change.
    • Stores clip mode with enum sanitization (DISABLE or ENABLE), matching SDK accepted-value domain.
    • Keeps GL_DEPTH_CLAMP disabled to avoid incorrect overdraw artifacts from prior approximation attempts.
  • Known divergence:
    • GX_CLIP_DISABLE is tracked but not fully emulated in GL rasterization path; clipping remains effectively enabled.