Skip to content

PGXP-style geometry/texture correction — feasible as a framework enhancement? #92

Description

@WGISpecialists

Summary

Would a PGXP-style geometry/texture correction pass be in scope for psxrecomp, as an optional framework-level enhancement?

For context on the ask: DuckStation (and other modern PS1 emulators) implement PGXP by running vertex transforms through a parallel high-precision path alongside the game's native GTE fixed-point math, then substitute the corrected coordinates before rasterization. This eliminates the vertex jitter/wobble and z-fighting caused by the PS1 GTE's 16-bit fixed-point precision, and (with the texture-correction variant) fixes perspective-incorrect texture warping on floor/wall polygons — all without touching game logic, since it's purely a geometry-pipeline substitution.

This is clearly framework-level (GTE + renderer), not per-game, so raising it here rather than on a game repo.

Why this is different for a static recompiler (not asking for a naive port)

I understand this isn't a drop-in port of DuckStation's implementation, since psxrecomp's architecture is fundamentally different from an interpreter/dynarec:

  • DuckStation hooks GTE opcodes at the interpreter/JIT dispatch layer, where there's a natural interception point before/after each instruction executes.
  • psxrecomp statically recompiles the game's actual GTE instruction stream into literal C — there's no dispatch-layer hook point at runtime; the "interception" would need to happen either (a) during recompilation/codegen, emitting shadow high-precision calls alongside the translated fixed-point GTE ops, or (b) via a runtime GTE-call wrapper if RTPS/RTPT/NCLIP/AVSZ3/AVSZ4/etc. already route through common runtime entry points rather than being fully inlined per call site.
  • The corrected vertex position then needs to survive from GTE output through to the GP0 primitive command and into the rasterizer (both SW and GL/Vulkan backends) without being collapsed back to PS1 fixed-point along the way — likely needs a parallel high-precision attribute channel threaded through the primitive/vertex pipeline, similar in spirit to the existing internal-resolution supersampling mirror.

Scope questions (genuinely asking, not proposing a design)

  • Do GTE ops in the recompiler's codegen already route through shared runtime entry points (vs. being fully inlined per call site)? That determines whether this is a runtime-side wrapper or a codegen-time change.
  • Is there an existing hook/extension point from the R1/R1b/R2 renderer work (OpenGL/Vulkan backends, ENHANCEMENTS.md) that a high-precision vertex channel could piggyback on, or would this need its own path in all three renderers (software/GL/Vulkan)?
  • Given the project's oracle-validation discipline (Beetle cross-checking), what would the intended validation story be for a geometry-correction feature — since by definition it's supposed to diverge from stock hardware output?

Not attempting this myself — flagging it as a possible framework enhancement since it'd benefit every title built on psxrecomp, not just one game, and wanted your read on feasibility/prior-art before anyone sinks time into it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions