Repository navigation
Gfx GX Fn GXSetChanMatColor
wowjinxy edited this page Apr 9, 2026
·
2 revisions
- Category:
Lighting - Matrix Status:
Implemented - Matrix Notes: Verified channel material color updates including packed
GX_COLOR0A0/GX_COLOR1A1handling. - Matrix Link: Gfx-GX-API-Matrix
- Manual page:
reference/man/gfx/gx/Lighting/GXSetChanMatColor.html - Reference source:
reference/gx/GXLight.c(GXSetChanMatColor) - SDK behavior:
- Signature:
void GXSetChanMatColor(GXChannelID chan, GXColor mat_color). - Updates material channel register for selected selector:
-
GX_COLOR0/GX_COLOR1: RGB only (preserve alpha). -
GX_ALPHA0/GX_ALPHA1: alpha only (preserve RGB). -
GX_COLOR0A0/GX_COLOR1A1: RGBA all components.
-
- Invalid channel ID asserts in SDK debug path.
- Signature:
- Public API declaration:
include/dolphin/gx/GXLighting.h - Runtime implementation:
src/gx/pc_gx.c(GXSetChanMatColor) - Behavior:
- Maps channel selector to channel group index and applies same component-selective writes.
- Converts
GXColorbytes to normalized float state (0..1) for backend lighting. - Flushes pending begin/vertex state before updating lighting state.
- Signature parity:
- SDK: typed
GXChannelID. - Porpoise: typed in public header; runtime definition uses internal
u32(ABI-equivalent).
- SDK: typed
- Behavioral parity:
- SDK: per-selector component update semantics (RGB-only, A-only, RGBA).
- Porpoise: same selector/component behavior.
- Known divergence:
- SDK invalid-channel path asserts; Porpoise fail-soft ignores invalid channels.
- SDK writes XF registers directly; Porpoise updates backend shadow state and marks lighting dirty.
- GX demo coverage checked
- Pikmin usage path checked
- Matrix status updated if needed
- Notes updated with concrete file/function references
- Verified component-selective channel behavior in
reference/gx/GXLight.candsrc/gx/pc_gx.c. - Material color is used when
GXSetChanCtrl(... mat_src = GX_SRC_REG)per manual.