Gfx GX Fn GXInitTexObjCI - wowjinxy/libPorpoise GitHub Wiki

GXInitTexObjCI

  • Category: Texture
  • Matrix Status: Implemented
  • Matrix Notes: Verified against SDK docs/source: delegates to GXInitTexObj, preserves CI mipmap default filter behavior, marks CI format path, and stores TLUT name.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Texture/GXInitTexObjCI.html
  • SDK source: reference/gx/GXTexture.c (GXInitTexObjCI)
  • SDK behavior:
    • Signature: void GXInitTexObjCI(GXTexObj* obj, void* image_ptr, u16 width, u16 height, GXCITexFmt format, GXTexWrapMode wrap_s, GXTexWrapMode wrap_t, GXBool mipmap, u32 tlut_name).
    • Calls GXInitTexObj(...) with CI format cast.
    • Marks texture as color-indexed path (not RGB) and stores TLUT name for load path.
    • CI+mipmap default min filter is GX_LIN_MIP_NEAR (inherited via GXInitTexObj behavior).

libPorpoise Implementation

  • Public API declaration: include/dolphin/gx/GXTexture.h
  • Runtime implementation: src/gx/pc_gx_texture.c (GXInitTexObjCI)
  • Behavior:
    • Signature matches SDK declaration.
    • Calls GXInitTexObj(...) first (so size/format/wrap/mipmap defaults are initialized identically).
    • Stores CI format and TLUT name in object state used by GXLoadTexObj.

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: GXInitTexObjCI(GXTexObj*, void*, u16, u16, GXCITexFmt, GXTexWrapMode, GXTexWrapMode, GXBool, u32)
    • Porpoise: same (image pointer type is const void* in API surface)
  • Behavioral parity:
    • SDK: delegates to GXInitTexObj, then sets CI-specific state and TLUT name.
    • Porpoise: same behavior.
  • Known divergence:
    • Low-level TMEM/TLUT placement is backend-approximated on PC, but object-init semantics are aligned.

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 needed in this pass; parity is already satisfied.