Gfx GX Fn GXInvalidateTexAll - wowjinxy/libPorpoise GitHub Wiki

GXInvalidateTexAll

  • Category: Texture
  • Matrix Status: Implemented
  • Matrix Notes: Implemented as full PC texture-cache invalidation (all cached texture objects are evicted and active texmap bindings cleared), matching SDK intent to force texture reload.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Texture/GXInvalidateTexAll.html
  • SDK source: reference/ACGC-PC-Port/src/static/dolphin/gx/GXTexture.c (GXInvalidateTexAll)
  • SDK behavior:
    • Signature: void GXInvalidateTexAll(void).
    • Invalidates all TMEM texture-cache tags (hardware global invalidate path).
    • Leaves preloaded texture data itself intact; forces cache reload on subsequent fetch.

libPorpoise Implementation

  • Public API declaration: include/dolphin/gx/GXTexture.h
  • Runtime implementation: src/gx/pc_gx_texture.c (GXInvalidateTexAll)
  • Behavior:
    • Signature matches SDK.
    • Flushes pending immediate primitive state before invalidate (pc_gx_flush_if_begin_complete()).
    • Evicts all software texture-cache entries via pc_gx_texture_cache_invalidate().
    • Clears matching active g_gx.gl_textures[] bindings during eviction so stale texture IDs are not reused.
    • Preserves external texture-pack ownership behavior (no forced deletion of external-owned GL textures).

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: GXInvalidateTexAll(void)
    • Porpoise: same
  • Behavioral parity:
    • SDK: global TMEM cache-tag invalidate.
    • Porpoise: global software cache eviction and active binding reset.
  • Known divergence:
    • No hardware TMEM tag/timing semantics on PC backend.
    • Preloaded-vs-cached TMEM distinction is approximated by software cache model.

Validation Checklist

  • GX demo coverage checked
  • Pikmin usage path checked
  • Matrix status updated if needed
  • Notes updated with concrete file/function references

Working Notes

  • This pass replaces previous no-op behavior with explicit “force reload” semantics on PC backend.