Gfx GX Fn GXSetTevIndirect - wowjinxy/libPorpoise GitHub Wiki
GXSetTevIndirect
- Category:
Indirect Texturing
- Matrix Status:
Partial
- Matrix Notes: Parity-checked API/state wiring plus shader-side handling for
GX_ITF_*, per-component bias, add_prev, and utc_lod; bump-alpha path remains approximated.
- Matrix Link: Gfx-GX-API-Matrix
Official SDK (Reference)
- Manual page:
reference/man/gfx/gx/Indirect/GXSetTevIndirect.html
- SDK source:
reference/gx/GXBump.c (GXSetTevIndirect, around lines 138+)
- Verified SDK behavior:
- Programs indirect behavior per TEV stage: indirect stage source, format, bias select, matrix select, wrap mode, add-prev, LOD-source choice, and bump-alpha select.
- Uses
CHECK_IN_BGN guard.
libPorpoise Implementation
- Runtime implementation area:
src/gx
- Public API surface:
include/dolphin/gx
- Current implementation:
src/gx/pc_gx.c: GXSetTevIndirect now does begin-safe update, enum sanitization/fail-soft defaults, and stores all indirect fields.
- Uniform packing now carries:
ind_stage, ind_mtx, ind_bias
- packed
{ind_format, ind_alpha}
- packed
{ind_add_prev, ind_lod} in wrap control
src/gx/shaders/default.frag:
- Applies
GX_ITF_8/5/4/3 precision quantization for indirect samples.
- Applies documented per-component bias policy (
-128 equivalent for ITF_8, +1 LSB equivalent for lower formats).
- Honors
add_prev for chained indirect offsets.
- Honors
utc_lod by sampling TEV texture with derivatives from unmodified coordinates (textureGrad path).
SDK vs Porpoise Diff
- Signature parity:
- SDK:
void GXSetTevIndirect(...)
- Porpoise: same
- Behavioral parity:
- SDK: complete per-stage indirect state programming in BP command stream.
- Porpoise: equivalent state intent mapped into shader/runtime state; key controls (
format, bias, matrix, wrap, add_prev, utc_lod) are now represented.
- Known divergence:
alpha_sel/bump-alpha output is still approximated (not fully modeled as GC fixed-function TEV side-channel behavior).
- Numeric edge behavior remains approximation of fixed-function integer pipeline.
Validation Checklist
Working Notes
- Build sanity target after update:
pikmin_demo (Win32 Debug).