feat(libSceNKWebKit): implement TransformationMatrix::applyPerspective #17643

Merged
sandivd merged 1 commit from upstream-pr/17643 into main 2026-11-12 04:13:50 +00:00
sandivd commented 2026-11-09 06:32:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by sandivd on 2026-11-09T06:32:09Z.


What

WebCore::TransformationMatrix::applyPerspective(double) (NID E4A0yvypFeA) previously threw through NotImplemented_nid_no_patch. It now follows the pinned PS5 WebKit reference (TransformationMatrix.cpp, TransformationMatrix.h): -1/p is written to m_matrix[2][3] of a new identity matrix only when p != 0, and the existing multiply export then composes this = mat * this unconditionally (also for zero, as in the pinned source, which has no zero early return), returning *this.

Six files: the throwing stub and its legacy declaration are removed (Export.cpp, LegacyExports.hpp); the typed declaration is added to WebCoreExports.hpp; the implementation to src/WebCoreTransform.cpp; TestApplyPerspective is registered in tests/WebCoreGeometry.cpp and runs through the real library boundary with alignment/offset canaries and a same-term-order SSE2 reference; the change and its verification limits are documented in docs/dev/debt/libSceNKWebKit.md.

Tested

Independently re-run during the final publication gate, on Linux (WSL2 Ubuntu 24.04, g++ 13.3.0, CMake Release + Ninja, BUILD_TESTING=ON), on a fresh snapshot of current upstream main with this patch applied, verified content-identical to the pushed commit by git tree-hash equality. All exit codes 0:

  • ctest -R nkwebkit_webcoregeometry --output-on-failure — 1/1 Passed. Includes the new TestApplyPerspective: 7 input matrices × 12 perspectives covering ±0.0, ±inf, NaN and denormals, plus a 4-step composition loop, checked through the real library boundary with alignment/offset canaries against a same-term-order SSE2 reference.
  • ctest -R guest_standard_streams --output-on-failure — 5/5 Passed.
  • ctest -R public_headers --output-on-failure — 65/65 Passed (public_headers audit: 407 libraries, 33661 exports, unique declarations and umbrella coverage; plus 64 compile shards).

Prior author-session evidence, kept for completeness but not re-executed during the final gate (logs in the author's local build directory):

  • Full test suites on Windows 11 (MSYS2/MinGW) and Linux: 108/108 tests passed on both OSes, including nkwebkit_webcoregeometry.
  • Registration checks on both OSes: 0 built and not run, none new; every source defining an APS5_VABI function compiled.
  • objdump of the Windows host object: SysV shape (self in RDI, double in XMM0, reference returned in RAX), -1/p via divsd into mat.m_matrix[2][3], multiply called even for zero.
  • Negative controls (Windows): restoring the throwing stub aborts the test naming _ZN7WebCore20TransformationMatrix16applyPerspectiveEd; a p == 0 early-return variant is caught by the test's NaN check.

Limitations: not verified against PS5 hardware or a console libSceNKWebKit module (documented in the debt entry); the full repository CTest suite was not run; host floating-point evaluation (rounding, NaN payloads) can differ from a console-compiled multiply (documented in the debt entry).

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5219760889 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/17643). Originally posted by [sandivd](https://github.com/sandivd) on 2026-11-09T06:32:09Z. --- ### What `WebCore::TransformationMatrix::applyPerspective(double)` (NID `E4A0yvypFeA`) previously threw through `NotImplemented_nid_no_patch`. It now follows the pinned PS5 WebKit reference ([TransformationMatrix.cpp](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/platform/graphics/transforms/TransformationMatrix.cpp#L1140-L1148), [TransformationMatrix.h](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h#L64-L92)): `-1/p` is written to `m_matrix[2][3]` of a new identity matrix only when `p != 0`, and the existing `multiply` export then composes `this = mat * this` unconditionally (also for zero, as in the pinned source, which has no zero early return), returning `*this`. Six files: the throwing stub and its legacy declaration are removed (`Export.cpp`, `LegacyExports.hpp`); the typed declaration is added to `WebCoreExports.hpp`; the implementation to `src/WebCoreTransform.cpp`; `TestApplyPerspective` is registered in `tests/WebCoreGeometry.cpp` and runs through the real library boundary with alignment/offset canaries and a same-term-order SSE2 reference; the change and its verification limits are documented in `docs/dev/debt/libSceNKWebKit.md`. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Independently re-run during the final publication gate, on Linux (WSL2 Ubuntu 24.04, g++ 13.3.0, CMake Release + Ninja, `BUILD_TESTING=ON`), on a fresh snapshot of current upstream `main` with this patch applied, verified content-identical to the pushed commit by git tree-hash equality. All exit codes 0: - `ctest -R nkwebkit_webcoregeometry --output-on-failure` — 1/1 Passed. Includes the new `TestApplyPerspective`: 7 input matrices × 12 perspectives covering ±0.0, ±inf, NaN and denormals, plus a 4-step composition loop, checked through the real library boundary with alignment/offset canaries against a same-term-order SSE2 reference. - `ctest -R guest_standard_streams --output-on-failure` — 5/5 Passed. - `ctest -R public_headers --output-on-failure` — 65/65 Passed (`public_headers` audit: 407 libraries, 33661 exports, unique declarations and umbrella coverage; plus 64 compile shards). Prior author-session evidence, kept for completeness but **not** re-executed during the final gate (logs in the author's local build directory): - Full test suites on Windows 11 (MSYS2/MinGW) and Linux: 108/108 tests passed on both OSes, including `nkwebkit_webcoregeometry`. - Registration checks on both OSes: 0 built and not run, none new; every source defining an `APS5_VABI` function compiled. - `objdump` of the Windows host object: SysV shape (self in RDI, `double` in XMM0, reference returned in RAX), `-1/p` via `divsd` into `mat.m_matrix[2][3]`, `multiply` called even for zero. - Negative controls (Windows): restoring the throwing stub aborts the test naming `_ZN7WebCore20TransformationMatrix16applyPerspectiveEd`; a `p == 0` early-return variant is caught by the test's NaN check. Limitations: not verified against PS5 hardware or a console `libSceNKWebKit` module (documented in the debt entry); the full repository CTest suite was not run; host floating-point evaluation (rounding, NaN payloads) can differ from a console-compiled multiply (documented in the debt entry). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!17643
No description provided.