Skip to content

gx: use zero texcoords when a texgen's source attribute is missing - #305

Open
StilesCrisis wants to merge 1 commit into
encounter:mainfrom
StilesCrisis:texgen-missing-texcoord
Open

StilesCrisis wants to merge 1 commit into
encounter:mainfrom
StilesCrisis:texgen-missing-texcoord

Conversation

@StilesCrisis

Copy link
Copy Markdown

If a texgen sources GX_TG_TEX0..GX_TG_TEX7 but the current vertex descriptor has no matching GX_VA_TEXn attribute, vtx_attr currently hits FATAL("unmapped vtx attr ..."). Some games intentionally leave a texgen configured from an earlier draw, which makes this abort at runtime. This change returns vec2f(0.0, 0.0) for those attributes instead, the same way missing colors and normals already get defaults.

Related: #272. I noticed after writing this that @Antidote's #272 targets the same abort. While reading that change I spotted one small thing that may be worth a look: the new range check is written as

if (attr >= GX_VA_TEX0 || attr <= GX_VA_TEX7) {

This condition is always true (I believe && was the intent). It would be fine to land #272 instead, if we change the || to && here.

This PR is just the vtx_attr part with the bounds check, which fixed the bug that I ran into. Thanks for all your work on Aurora!

A texgen whose source is GX_TG_TEX0..7 can be enabled while the current
vertex descriptor has no matching GX_VA_TEXn attribute (some games leave
a texgen set up from an earlier draw). vtx_attr hit FATAL in that case.
Feed (0, 0) instead, the same way missing colors and normals already get
defaults; Dolphin likewise substitutes zero for a missing source
texcoord.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjpWoYqNDKkH5Zpdbz3WaW
@StilesCrisis
StilesCrisis force-pushed the texgen-missing-texcoord branch from 15155f2 to 04fbec8 Compare November 7, 2026 02:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant