Skip to content

Preserve LOVE 11 shader coordinates without inverting embedded HUDs - #193

Open
Roxas2712 wants to merge 7 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/love12-world-orientation
Open

Roxas2712 wants to merge 7 commits into
UNDERdecoded:mainfrom
Roxas2712:codex/love12-world-orientation

Conversation

@Roxas2712

@Roxas2712 Roxas2712 commented Oct 24, 2026 •

Copy link
Copy Markdown

Legacy custom 3D shaders authored for LÖVE 11 produce inverted canvas geometry on LÖVE 12. Reflecting a completed world image corrects the terrain but also inverts ordinary 2D HUDs already painted into that image. Actual VASC battle screenshots reproduce both failures.

Normalize the high-level vertex shader entry point before composition. On a canvas, expose the legacy matrix convention through the position argument and global projection aliases, then normalize the resulting clip Y. The two changes cancel for ordinary matrix-based 2D shaders; custom 3D projection output is corrected before native UI, weather or embedded battle HUDs join the canvas. Target/shader changes and graphics-stack restoration keep the uniform in sync. Pixel-only shaders, low-level vertexmain, shaders explicitly marked native or already adapted in source or compiler options, and LÖVE 11 keep their existing behavior. Named and array compiler definitions preserve the original source/filename/FileData and options table without a redundant read or source allocation; inherited definitions are also protected at compile time. Identifier suffixes do not accidentally opt out. Existing native custom-coordinate adapters opt out explicitly to avoid a second conversion.

World images default to upright presentation. Explicit worldOrientation="legacy" remains available for an unconverted image; detached/native images and separate engine UI retain their conventions. No mod-specific branches, OS spoofing, mod source edits or compatibility-gate bypasses.

Validation:

  • Independent patch on upstream main 13af468: 57 shader/state checks and 151 real-compositor/FX recording checks pass.
  • ROM-free GPU checker on the independent patch: LÖVE 12 OpenGL and Metal each pass 304 checks across seven mixed 3D/HUD, matrix-argument/global/alias, native-opt-out, raw-entry-point, MRT, stack-restoration and culling cases. Stock LÖVE 11.5 passes 220 checks across its five applicable cases. Front/back culling matches the measured LÖVE 11.5 baseline.
  • Disabling the shader adaptation in the LÖVE 12 GPU checker deliberately fails its asymmetric red-top assertion.
  • Composed API-3 fork: all 233 engine suites, SDK 3/3 and B30 pass; preview package tests 7/7. Actual fresh Smaragd and Feuerrot imports and OpenGL movement/map-change/resize/return checks pass (23,073 / 22,758 assertions).
  • Composed fused macOS preview with unchanged VASC 3.0.65-rc.4 + KASC 6.7.35-rc.2 and real Red: First/Third Person battle menus, names, HP and geometry visually upright in four owned OpenGL window captures. Both native attacks spend one PP and damage the opponent; RUN restores the original field position. First uses the route arena; Third chooses the mod's terrarium fallback. No universal map-arena acceptance is claimed.

The real Metal battle run obtained its first window capture but a later OS screenshot timed out; it is not counted as complete Metal gameplay acceptance. Metal shader pixels are independently verified as above. An unchanged supplied Johto package currently fails before camera verification because its generated function exceeds LuaJIT’s 60-upvalue limit. The same package fails identically on the parent composed fork without the compiler-option correction; neither attempt counts as successful gameplay verification. No ROMs or mod assets are included. Windows GPU execution and complete engine/mod parity remain open.

Additional compiler-option regression validation:

  • Independent upstream patch: 119/119 targeted CPU checks.
  • On the final production module, LÖVE 12 OpenGL and Metal each pass 510 checks / 240 exact full-RGBA pairs across native/already-adapted map, array and inherited compiler definitions; combined/split strings, filenames and FileData; direct/table canvas targets; four sizes including portrait and DPI 1/2. Invalid sources continue to fail validation and compilation.
  • Existing orientation checker remains 304/304 on each backend. Composed fork remains 324/324 engine suites, SDK 3/3 and B30 passing.
  • Before the correction, the new actual GPU test fails because an explicit native compiler definition is ignored and the source is rewritten. Source hashes, reproduction and limitations are recorded in docs/qa/shader-compiler-options.md.

Self-converting canvas follow-up: preserve a complete position forwarding wrapper that already negates its returned clip Y. This prevents double conversion in an unchanged renderer without keying on its package or helper name. Partial and differently shaped wrappers retain the legacy path. The new asymmetric GPU fixture fails before this fix; afterwards Metal and OpenGL each pass 348 checks across eight cases. CPU shader checks pass 125/125 and native compositor orientation checks pass 151/151. A fresh ROM-backed field observation confirms an upright scene; full mod, battle and display-resolution acceptance remain separate. These follow-up tests retain 8 GiB free and use owned QA profiles.

Derivative-program integration with #337: preserve the exact preceding constructor as compileNative. Derived shader programs already use the admitted canvas convention; re-analyzing a modified forwarding entry could adapt that projection twice. The internal seam preserves source/options without injecting a producer macro. The independent module now passes 128 targeted CPU checks; the actual native M3/Metal fixture passes 73 API/lifetime/stage-sampler checks with the seam. Deliberately re-entering the adapter fails its asymmetric spatial pixel comparison. These are shader-contract observations, with separate full-frame/gameplay qualification; fresh owned profiles and 20 GiB free reserve are used. The contribution licence is included in this branch.

Contributions by Roxas2712 — https://github.com/Roxas2712. The covered PR contributions retain the specific integration permission for Cedric / UNDERdecoded and credit requirement in LICENSE-ROXAS2712.md; existing third-party notices and rights remain intact.

@Roxas2712 Roxas2712 changed the title Fix upside-down legacy 3D worlds on LOVE 12 Preserve LOVE 11 shader coordinates without inverting embedded HUDs Oct 24, 2026
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