Gfx GX Fn GXSetTevAlphaOp - wowjinxy/libPorpoise GitHub Wiki

GXSetTevAlphaOp

  • Category: Texture Environment
  • Matrix Status: Implemented
  • Matrix Notes: Implemented alpha combiner op/bias/scale/clamp-enable/output configuration.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Tev/GXSetTevAlphaOp.html
  • SDK source: reference/ACGC-PC-Port/src/static/dolphin/gx/GXTev.c (GXSetTevAlphaOp)
  • SDK behavior:
    • Programs TEV alpha op, bias, scale, clamp flag, and destination register for one stage.
    • Supports add/sub ops and HW2 compare ops (GX_TEV_COMP_*).
    • For compare ops, HW register encoding forces compare-mode path (bias field encoded as compare selector).
    • SDK debug path asserts on invalid stage.

libPorpoise Implementation

  • Public API declaration: include/dolphin/gx/GXTev.h
  • Runtime implementation: src/gx/pc_gx.c (GXSetTevAlphaOp)
  • Behavior:
    • Stores op/bias/scale/clamp/out_reg per TEV stage and marks TEV state dirty.
    • BP display-list decode path maps compare-encoded BP state into GX_TEV_COMP_* op values before calling setter.

SDK vs Porpoise Diff

  • Signature parity:
    • Signatures match.
  • Behavioral parity:
    • Add/sub op state wiring matches.
  • Known divergence:
    • SDK compare-op behavior is explicitly encoded in TEV pipeline semantics; current PC shader tevStage path handles add/sub but does not fully implement GX_TEV_COMP_* alpha compare semantics yet.
    • SDK debug asserts invalid stage; Porpoise fail-soft ignores out-of-range stage.

Validation Checklist

  • GX demo coverage checked
  • Pikmin usage path checked
  • Matrix status updated if needed
  • Notes updated with concrete file/function references

Working Notes

  • No runtime code change required in this pass; compare-op divergence is documented for follow-up.