Gfx GX Fn GXSetIndTexCoordScale - wowjinxy/libPorpoise GitHub Wiki

GXSetIndTexCoordScale

  • Category: Indirect Texturing
  • Matrix Status: Implemented
  • Matrix Notes: Parity-checked per-stage indirect S/T scale programming, with begin-safe state update and fail-soft scale clamp.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Indirect/GXSetIndTexCoordScale.html
  • SDK source: reference/gx/GXBump.c (GXSetIndTexCoordScale, around lines 247+)
  • Verified SDK behavior:
    • Programs S/T indirect-coordinate scale for stages GX_INDTEXSTAGE0..3.
    • Uses CHECK_IN_BGN guard (state update not allowed inside active begin).
    • Switches on stage and writes to one of two packed scale registers (RAS1_SS0 / RAS1_SS1).

libPorpoise Implementation

  • Runtime implementation area: src/gx
  • Public API surface: include/dolphin/gx
  • Current implementation:
    • src/gx/pc_gx.c: GXSetIndTexCoordScale now flushes pending begin state, validates stage against GX_MAX_INDTEXSTAGE, and writes scale selectors into per-stage runtime state used by the shader upload path.
    • Scale values outside documented enum range are clamped fail-soft to GX_ITS_256.

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: void GXSetIndTexCoordScale(GXIndTexStageID ind_stage, GXIndTexScale scale_s, GXIndTexScale scale_t)
    • Porpoise: same
  • Behavioral parity:
    • SDK: stage-based indirect scale programming with begin guard.
    • Porpoise: same stage mapping semantics and begin-safe update behavior.
  • Known divergence:
    • SDK relies on debug asserts / enum-typed values; Porpoise applies fail-soft scale clamping for out-of-range inputs.

Validation Checklist

  • GX demo coverage checked (indirect scaling path)
  • Pikmin usage path checked (indirect texcoord sampling scales)
  • Matrix status updated if needed
  • Notes updated with concrete file/function references

Working Notes

  • Build sanity target after update: pikmin_demo (Win32 Debug).