Skip to content

gx: mark vertex positions with @invariant - #314

Open
StilesCrisis wants to merge 1 commit into
encounter:mainfrom
StilesCrisis:invariant-position
Open

StilesCrisis wants to merge 1 commit into
encounter:mainfrom
StilesCrisis:invariant-position

Conversation

@StilesCrisis

Copy link
Copy Markdown

My decomp draws decals by reusing existing geometry, but with a different pipeline and an LEQUAL depth test. This only works if the same vertices produce the same depth. WebGPU only guarantees that across pipelines for positions marked @invariant, so without it, the decals can z-fight. There's no downside here except a hypothetical tiny perf hit.

Games draw decals by redrawing existing geometry with a different
pipeline and an LEQUAL depth test, relying on the same vertices
producing the same depth. WebGPU only guarantees that across pipelines
for positions marked @invariant, so without it the decals z-fight on
some GPUs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SjpWoYqNDKkH5Zpdbz3WaW
@StilesCrisis

Copy link
Copy Markdown
Author

Followup: this worked great on Metal, however it seems to be a no-op on DX12. Apparently @invariant is only implemented in DX12 as precise and that isn't sufficient to get bit-exact floating point. So this PR would still be fine to land--it's not wrong--but games targeting Windows (~everyone?) will still need some sort of hand-rolled fix for LEQUAL decals.

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.

2 participants