Gfx GX Fn GXSetTevKColor HW2 - wowjinxy/libPorpoise GitHub Wiki
GXSetTevKColor (HW2)
- Category:
Texture Environment
- Matrix Status:
Implemented
- Matrix Notes: Implemented typed konst-color register upload (
GXColor) for all four HW2 konst registers.
- Matrix Link: Gfx-GX-API-Matrix
Official SDK (Reference)
- Manual page:
reference/man/gfx/gx/Tev/GXSetTevKColor.html
- SDK source:
reference/ACGC-PC-Port/src/static/dolphin/gx/GXTev.c (GXSetTevKColor)
- SDK behavior:
- Sets one HW2 konst-color register (
GX_KCOLOR0..3) using GXColor (8-bit RGBA).
- Writes two BP words (
RA and BG) for the selected konst register.
- SDK debug path checks GX-begin state.
libPorpoise Implementation
- Public API declaration:
include/dolphin/gx/GXTev.h
- Runtime implementation:
src/gx/pc_gx.c (GXSetTevKColor)
- Shader consumption:
- Uploaded as
u_kcolor[4] from runtime state.
- Used by
getKonstC/getKonstA in src/gx/shaders/default.frag when GX_CC_KONST/GX_CA_KONST are selected.
- Behavior:
- Stores RGBA in
g_gx.tev_k_colors[id] as normalized floats (/255.0f).
- Marks
PC_GX_DIRTY_KONST for uniform upload.
- Applies fail-soft guard
id < 4.
SDK vs Porpoise Diff
- Signature parity:
- Signatures match (
GXTevKColorID, GXColor).
- Behavioral parity:
- Const-color register update semantics match TEV shader usage for all 4 konst registers.
- Known divergence:
- SDK writes BP registers directly; Porpoise stores decoded normalized state and evaluates in shader.
- Porpoise uses fail-soft
id < 4 guard instead of debug assert behavior.
Validation Checklist
Working Notes
- No runtime code change required in this pass.