Gfx GX Fn GXSetTevOp - wowjinxy/libPorpoise GitHub Wiki
GXSetTevOp
Category: Texture Environment
Matrix Status: Implemented
Matrix Notes: Implemented helper wiring for MODULATE/DECAL/BLEND/REPLACE/PASSCLR; stage 0 uses raster color/alpha and later stages use CPREV/APREV per GX docs.
Matrix Link: Gfx-GX-API-Matrix
Official SDK (Reference)
Manual page: reference/man/gfx/gx/Tev/GXSetTevOp.html
SDK source: reference/ACGC-PC-Port/src/static/dolphin/gx/GXTev.c (GXSetTevOp)
SDK behavior:
Convenience helper that programs GXSetTevColorIn, GXSetTevAlphaIn, then sets both color/alpha ops to ADD/ZERO/SCALE_1/CLAMP/PREV.
Uses GX_CC_RASC/GX_CA_RASA for stage 0 and GX_CC_CPREV/GX_CA_APREV for later stages.
Mode mappings: MODULATE, DECAL, BLEND, REPLACE, PASSCLR exactly as in manual table.
SDK debug path asserts on invalid mode.
libPorpoise Implementation
Public API declaration: include/dolphin/gx/GXTev.h
Runtime implementation: src/gx/pc_gx.c (GXSetTevOp)
Behavior:
Matches SDK stage-0 vs stage-N source selection and all five mode mappings.
Calls GXSetTevColorOp/GXSetTevAlphaOp with the same fixed op tuple used by SDK.
Marks TEV stage state dirty via called setters; no extra side effects.
SDK vs Porpoise Diff
Signature parity:
SDK and Porpoise signatures match (GXTevStageID, GXTevMode).
Behavioral parity:
Mode wiring and stage-0 special-case behavior match SDK.
Known divergence:
SDK asserts on invalid mode; Porpoise fail-soft returns without mutating TEV stage when mode is invalid.
Validation Checklist
Working Notes
No runtime code change required in this pass.
🗂️ Page Index for this GitHub Wiki