Gfx GX Fn GXColor family - wowjinxy/libPorpoise GitHub Wiki

GXColor[n][t]

  • Category: Geometry and Vertex
  • Matrix Status: Partial
  • Matrix Notes: SDK/manual parity reviewed for direct+indexed color submission and packed decode (RGB565/RGB8/RGBX8/RGBA4/RGBA6/RGBA8). Added call-order routing for CLR0/CLR1 and shader path now consumes per-vertex color1 for channel1 sources.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: E:/GPT5/Porpoise_SDK/libPorpoise/reference/man/gfx/gx/Geometry/GXColor.html
  • Related pages:
    • E:/GPT5/Porpoise_SDK/libPorpoise/reference/man/gfx/gx/Geometry/GXBegin.html
    • E:/GPT5/Porpoise_SDK/libPorpoise/reference/man/gfx/gx/Geometry/GXSetVtxDesc.html
    • E:/GPT5/Porpoise_SDK/libPorpoise/reference/man/gfx/gx/Geometry/GXSetVtxAttrFmt.html
    • E:/GPT5/Porpoise_SDK/libPorpoise/reference/man/gfx/gx/Geometry/GXSetArray.html
  • SDK source parity check area: E:/GPT5/ACGC-PC-Port-Debug-Stuff/src/static/dolphin/gx/GXVert.c
  • Notes:
    • Signature family matches manual (GXColor4u8, GXColor3u8, GXColor1u32, GXColor1u16, GXColor1x16, GXColor1x8).
    • Manual confirms packed/direct flexibility (GXColor4u8 and GXColor1u32 equivalent for RGBA8-style payloads).
    • Manual confirms descriptor/order requirements between GXBegin/GXEnd.

libPorpoise Implementation

  • Runtime implementation area: E:/GPT5/Porpoise_SDK/libPorpoise/src/gx/pc_gx.c
  • Public API surface: E:/GPT5/Porpoise_SDK/libPorpoise/include/dolphin/gx/GXVert.h
  • Notes:
    • API signatures match manual family.
    • Direct and indexed paths decode/submit all expected packed color types used in GX demos.
    • Color target selection now follows descriptor/call-order semantics (CLR0 first, then CLR1 when both are enabled).
    • Vertex shader/fragment shader path now carries color1 so channel1 vertex-source lighting can differ from channel0.

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: full GXColor[n][t] family.
    • Porpoise: matching function family.
  • Behavioral parity:
    • SDK: color submission follows enabled attribute order (GX_VA_CLR0 / GX_VA_CLR1).
    • Porpoise: now routes color writes by descriptor/call phase and preserves both color channels per vertex.
  • Known divergence:
    • SDK debug library validates strict call order; PC backend currently fails soft.
    • Rare edge cases with malformed call sequences are tolerated rather than asserted.

Validation Checklist

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

Working Notes

  • Runtime color routing helpers live near GXColor4u8 in pc_gx.c; shader changes are in src/gx/shaders/default.vert and default.frag.