Gfx GX Fn GXSetTevIndBumpST - wowjinxy/libPorpoise GitHub Wiki

GXSetTevIndBumpST

  • Category: Indirect Texturing
  • Matrix Status: Implemented
  • Matrix Notes: Parity-checked 3-stage EMBM helper sequence (S*, T*, then feedback stage) over GXSetTevIndirect.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Indirect/GXSetTevIndBumpST.html
  • SDK source: reference/gx/GXBump.c (GXSetTevIndBumpST, around lines 488+)
  • Verified SDK behavior:
    • Accepts matrix_sel only in {GX_ITM_0, GX_ITM_1, GX_ITM_2} for this helper path.
    • Maps selected matrix slot to paired ST matrix selectors:
      • GX_ITM_0 -> {GX_ITM_S0, GX_ITM_T0}
      • GX_ITM_1 -> {GX_ITM_S1, GX_ITM_T1}
      • GX_ITM_2 -> {GX_ITM_S2, GX_ITM_T2}
    • Programs three consecutive TEV stages:
      1. stage tev_stage: ITF_8, ITB_ST, matrix S*, wrap 0/0, add_prev FALSE
      2. stage tev_stage+1: ITF_8, ITB_ST, matrix T*, wrap 0/0, add_prev TRUE
      3. stage tev_stage+2: ITF_8, ITB_NONE, matrix OFF, wrap OFF/OFF, add_prev TRUE
    • utc_lod is FALSE and alpha_sel is OFF in all three calls.

libPorpoise Implementation

  • Runtime implementation area: src/gx
  • Public API surface: include/dolphin/gx
  • Current implementation:
    • src/gx/pc_gx.c: helper sequence and parameters match SDK mappings and per-stage call pattern.
    • Invalid matrix_sel fails soft (return) where SDK debug build asserts.

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: void GXSetTevIndBumpST(GXTevStageID tev_stage, GXIndTexStageID ind_stage, GXIndTexMtxID matrix_sel)
    • Porpoise: same
  • Behavioral parity:
    • Core 3-stage helper behavior matches SDK.
  • Known divergence:
    • Invalid matrix handling is fail-soft return instead of SDK debug assert.

Validation Checklist

  • GX demo coverage checked (EMBM helper path)
  • Pikmin usage path checked (indirect helper forwarding path)
  • Matrix status updated if needed
  • Notes updated with concrete file/function references

Working Notes

  • No runtime patch required for this function; implementation already matched SDK helper behavior.