Gfx GX Fn GXSetTevColorIn - wowjinxy/libPorpoise GitHub Wiki

GXSetTevColorIn

  • Category: Texture Environment
  • Matrix Status: Implemented
  • Matrix Notes: Implemented with typed TEV color args and per-stage state updates.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Tev/GXSetTevColorIn.html
  • SDK source: reference/ACGC-PC-Port/src/static/dolphin/gx/GXTev.c (GXSetTevColorIn)
  • SDK behavior:
    • Programs TEV color combiner inputs a,b,c,d for a specific TEV stage.
    • Writes TEV stage color-input register fields; no direct color-op mutation.
    • SDK debug path asserts stage range and argument ranges (a..d <= 15).
    • HW2 note: this API does not modify texture component swap mode; swap selection is handled via GXSetTevSwapMode / GXSetTevSwapModeTable.

libPorpoise Implementation

  • Public API declaration: include/dolphin/gx/GXTev.h
  • Runtime implementation: src/gx/pc_gx.c (GXSetTevColorIn)
  • Behavior:
    • Stores a,b,c,d per TEV stage in renderer state and marks TEV state dirty.
    • Does not modify swap mode state (HW2-style behavior).
    • Ignores out-of-range stage by returning early.

SDK vs Porpoise Diff

  • Signature parity:
    • Signatures match (GXTevStageID, four GXTevColorArg operands).
  • Behavioral parity:
    • Stage-local color-input programming behavior matches intended TEV semantics.
    • No implicit swap-mode mutation, aligned with HW2 documentation.
  • Known divergence:
    • SDK debug path asserts on invalid stage/operand ranges; Porpoise fail-soft ignores invalid stage and does not enforce operand-range asserts in this setter path.

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.