Gfx GX Fn GXSetTexCoordCylWrap - wowjinxy/libPorpoise GitHub Wiki

GXSetTexCoordCylWrap

  • Category: Texture Coordinate Generation
  • Matrix Status: Partial
  • Matrix Notes: Added API/runtime symbol + per-texcoord S/T cylindrical-wrap state, with approximate seam-wrapping in shader before TEV sampling.
  • Matrix Link: Gfx-GX-API-Matrix

Official SDK (Reference)

  • Manual page: reference/man/gfx/gx/Texture/GXSetTexCoordCylWrap.html
  • SDK source: reference/gx/GXTexture.c (GXSetTexCoordCylWrap)
  • SDK behavior:
    • Signature: void GXSetTexCoordCylWrap(GXTexCoordID coord, GXBool s_enable, GXBool t_enable).
    • Updates SU cylindrical-wrap enable bits (WS/WT) in suTs0/suTs1.
    • Writes SU registers immediately when manual texcoord scaling is currently enabled for that coord.

libPorpoise Implementation

  • Public API declaration: include/dolphin/gx/GXTexture.h
  • Runtime implementation: src/gx/pc_gx.c (GXSetTexCoordCylWrap)
  • Internal state: src/gx/pc_gx_internal.h
  • Shader path: src/gx/shaders/default.frag
  • Behavior:
    • API signature now matches SDK.
    • Validates coord < GX_MAX_TEXCOORD.
    • Flushes begin-state, marks texgen dirty, and stores per-texcoord S/T cylindrical-wrap enable bits.
    • Shader applies approximate cylindrical seam remap (tc -= floor(tc + 0.5)) per enabled component before texture lookup.

SDK vs Porpoise Diff

  • Signature parity:
    • SDK: void GXSetTexCoordCylWrap(GXTexCoordID, GXBool, GXBool)
    • Porpoise: same
  • Behavioral parity:
    • SDK: SU interpolation adjustment around 0/1 seam with hardware clipping caveats.
    • Porpoise: per-component wrap enable is honored with shader-side seam remap approximation.
  • Known divergence:
    • Hardware SU seam interpolation behavior is approximated; clipping/guard-band interactions are not emulated.
    • Interaction timing with low-level SU register programming is represented via high-level state upload, not BP register writes.

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 symbol was previously absent from the PC runtime implementation and is now wired end-to-end.