feat(libSceNKWebKit): implement WebCore::TranslateTransformOperation #22872

Merged
FinleyLaempe merged 9 commits from upstream-pr/22872 into main 2026-11-22 18:48:02 +00:00
FinleyLaempe commented 2026-11-18 13:13:36 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by FinleyLaempe on 2026-11-18T13:13:36Z.


What

Implements the 20 WebCore::TranslateTransformOperation exports of libSceNKWebKit (both create overloads, the C1/C2 constructors, the D0/D1/D2 destructors, the Length- and FloatSize-taking x/y/z, isIdentity, isRepresentableIn2D, apply, dump, clone, operator== and blend), replacing the NotImplemented_nid_no_patch stubs in Export.cpp.

  • Behaviour follows the pinned TranslateTransformOperation.cpp and its Length blending from Length.cpp. The new file carries the upstream notices of TranslateTransformOperation.cpp/.h, Length.cpp and TransformOperation.cpp, as AGENTS.md asks for adapted code.
  • Guest layouts live in RegionExports.hpp: a 16-byte TransformOperation base (vptr, refCount, type enum), a 40-byte TranslateTransformOperation (m_x/m_y/m_z at offsets 16/24/32) and an 8-byte TransformOperationRef, with static asserts. The 12-slot vtable (destructors, clone, selfOrCopyWithResolvedCalculatedValues, operator==, isIdentity, apply, blend, primitiveType, isAffectedByTransformOrigin, isRepresentableIn2D, dump) is laid out per the pinned TransformOperation.h.
  • The firmware exports disagree with the pinned class: blend takes double progress and bool blendToIdentity where the pinned class takes a BlendingContext, and the size getters export as x/y/z(FloatSize) where the pinned class has xAsFloat/yAsFloat/zAsFloat. The implementation follows the firmware signatures and is not compared with a console module.
  • blend reads the firmware double as BlendingContext::progress with Replace semantics and computes the float blend in double before rounding; where the pinned sharedPrimitiveType finds no shared primitive with from it returns a ref to *this with the refcount bumped.
  • Reuses the existing WebCore::floatValueForLength (WebCoreLayoutExports.hpp) in the size getters, isIdentity and the vtable-only selfOrCopyWithResolvedCalculatedValues, WebCore::TransformationMatrix::translate3d (WebCoreExports.hpp) in apply, and the WTF TextStream and fastMalloc/fastFree wrappers.
  • Length does not model CalculationValue reference counting, so the constructors, create, clone, the destructors and the Length-returning x/y/z throw NotImplemented_nid_no_patch when a member is Calculated; the calculated branch of blendMixedTypes, dump and operator== of calculated lengths, and floatValueForLength in the size getters, isIdentity and selfOrCopyWithResolvedCalculatedValues also throw.
  • dump throws on an out-of-range operation type where the pinned stream operator prints nothing.
  • Every export rejects a null this with std::invalid_argument; the constructors and create also reject non-translate TransformOperation::Type values.
  • The 20 exports move from the generic stub declarations in Api.hpp and LegacyExports.hpp to the new typed header WebCoreTransformExports.hpp, included from libSceNKWebKit.hpp.
  • Beyond stub removal, RegionExports.hpp gains a float-value Length constructor (needed for blend results) and a <type_traits> include, and main's PerspectiveTransformOperation files rename their base (see the PerspectiveTransformOperation point below).
  • A new debt fragment adds the TranslateTransformOperation layout-and-vtable and behaviour entries, both noting the work is not compared with a console module; no debt entries are removed.
  • Main's PerspectiveTransformOperation (include/PerspectiveTransformOperationExports.hpp) is exported by the 3.20 module only, whose WebKit revision stores the operation type as a 4-byte OperationType with PERSPECTIVE = 19, while this PR's TranslateTransformOperation follows the pinned 11.x one-byte Type enum (TransformOperation.h:41), where Perspective is 20. The two bases therefore stay separate: since RegionExports.hpp now defines WebCore::TransformOperation, Perspective's own 16-byte base (type at 12) keeps its layout and behaviour under the name LegacyTransformOperation, as main's LegacyLength does for the same module. Main's Perspective code and test change only in that name.

Tested

Arch Linux x86-64, GCC 16.2.1, Release build with -DBUILD_TESTING=ON: the new nkwebkit_translatetransformoperation test and every other nkwebkit_* test, 155 of 155 passed. python3 tools/check_conventions.py --base upstream/main passes. Not tested on a console or on Windows.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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:5376654091 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22872). Originally posted by [FinleyLaempe](https://github.com/FinleyLaempe) on 2026-11-18T13:13:36Z. --- ### What Implements the 20 `WebCore::TranslateTransformOperation` exports of libSceNKWebKit (both `create` overloads, the `C1`/`C2` constructors, the `D0`/`D1`/`D2` destructors, the `Length`- and `FloatSize`-taking `x`/`y`/`z`, `isIdentity`, `isRepresentableIn2D`, `apply`, `dump`, `clone`, `operator==` and `blend`), replacing the `NotImplemented_nid_no_patch` stubs in `Export.cpp`. - Behaviour follows the pinned [`TranslateTransformOperation.cpp`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.cpp#L55) and its `Length` blending from [`Length.cpp`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/platform/Length.cpp). The new file carries the upstream notices of `TranslateTransformOperation.cpp/.h`, `Length.cpp` and `TransformOperation.cpp`, as AGENTS.md asks for adapted code. - Guest layouts live in `RegionExports.hpp`: a 16-byte `TransformOperation` base (vptr, refCount, type enum), a 40-byte `TranslateTransformOperation` (`m_x`/`m_y`/`m_z` at offsets 16/24/32) and an 8-byte `TransformOperationRef`, with static asserts. The 12-slot vtable (destructors, `clone`, `selfOrCopyWithResolvedCalculatedValues`, `operator==`, `isIdentity`, `apply`, `blend`, `primitiveType`, `isAffectedByTransformOrigin`, `isRepresentableIn2D`, `dump`) is laid out per the pinned [`TransformOperation.h`](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/platform/graphics/transforms/TransformOperation.h). - The firmware exports disagree with the pinned class: `blend` takes `double progress` and `bool blendToIdentity` where the pinned class takes a `BlendingContext`, and the size getters export as `x`/`y`/`z(FloatSize)` where the pinned class has `xAsFloat`/`yAsFloat`/`zAsFloat`. The implementation follows the firmware signatures and is not compared with a console module. - `blend` reads the firmware `double` as `BlendingContext::progress` with Replace semantics and computes the float blend in double before rounding; where the pinned `sharedPrimitiveType` finds no shared primitive with `from` it returns a ref to `*this` with the refcount bumped. - Reuses the existing `WebCore::floatValueForLength` (`WebCoreLayoutExports.hpp`) in the size getters, `isIdentity` and the vtable-only `selfOrCopyWithResolvedCalculatedValues`, `WebCore::TransformationMatrix::translate3d` (`WebCoreExports.hpp`) in `apply`, and the WTF `TextStream` and `fastMalloc`/`fastFree` wrappers. - `Length` does not model `CalculationValue` reference counting, so the constructors, `create`, `clone`, the destructors and the `Length`-returning `x`/`y`/`z` throw `NotImplemented_nid_no_patch` when a member is Calculated; the calculated branch of `blendMixedTypes`, `dump` and `operator==` of calculated lengths, and `floatValueForLength` in the size getters, `isIdentity` and `selfOrCopyWithResolvedCalculatedValues` also throw. - `dump` throws on an out-of-range operation type where the pinned stream operator prints nothing. - Every export rejects a null `this` with `std::invalid_argument`; the constructors and `create` also reject non-translate `TransformOperation::Type` values. - The 20 exports move from the generic stub declarations in `Api.hpp` and `LegacyExports.hpp` to the new typed header `WebCoreTransformExports.hpp`, included from `libSceNKWebKit.hpp`. - Beyond stub removal, `RegionExports.hpp` gains a float-value `Length` constructor (needed for blend results) and a `<type_traits>` include, and main's `PerspectiveTransformOperation` files rename their base (see the `PerspectiveTransformOperation` point below). - A new debt fragment adds the `TranslateTransformOperation` layout-and-vtable and behaviour entries, both noting the work is not compared with a console module; no debt entries are removed. - Main's `PerspectiveTransformOperation` (`include/PerspectiveTransformOperationExports.hpp`) is exported by the 3.20 module only, whose WebKit revision stores the operation type as a 4-byte `OperationType` with `PERSPECTIVE` = 19, while this PR's `TranslateTransformOperation` follows the pinned 11.x one-byte `Type` enum ([TransformOperation.h:41](https://github.com/neonmodder123/PS5-WebKit-11.x/blob/80f77e94c63ee7202eec3d4b5b1a021dd89011ba/Source/WebCore/platform/graphics/transforms/TransformOperation.h#L41)), where Perspective is 20. The two bases therefore stay separate: since `RegionExports.hpp` now defines `WebCore::TransformOperation`, Perspective's own 16-byte base (type at 12) keeps its layout and behaviour under the name `LegacyTransformOperation`, as main's `LegacyLength` does for the same module. Main's Perspective code and test change only in that name. ### Tested Arch Linux x86-64, GCC 16.2.1, Release build with `-DBUILD_TESTING=ON`: the new `nkwebkit_translatetransformoperation` test and every other `nkwebkit_*` test, 155 of 155 passed. `python3 tools/check_conventions.py --base upstream/main` passes. Not tested on a console or on Windows. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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
copilot-pull-request-reviewer[bot] commented 2026-11-18 13:14:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-18T13:14:10Z.

Review: COMMENTED


Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5957285014 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22872#pullrequestreview-5957285014). Originally posted by [copilot-pull-request-reviewer[bot]](https://github.com/apps/copilot-pull-request-reviewer) on 2026-11-18T13:14:10Z. **Review:** COMMENTED --- Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
PrivacyOnion commented 2026-11-18 13:16:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T13:16:28Z.

Review: APPROVED


Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against 6a7183d781:

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_translatetransformoperation_tests built cleanly.
  • CTest (nkwebkit_translatetransformoperation):
    1/1 Test #4580: nkwebkit_translatetransformoperation ...   Passed    0.01 sec
    100% tests passed, 0 tests failed out of 1
    
  • Negative control: with core/libs/prx/libSceNKWebKit/Export.cpp, core/libs/prx/libSceNKWebKit/include/Api.hpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/include/RegionExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp, core/libs/prx/libSceNKWebKit/src/TranslateTransformOperation.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified WebCore::TranslateTransformOperation guest ABI layout (16-byte base, 40-byte total size, m_x/m_y/m_z offsets at 16/24/32, and 8-byte TransformOperationRef) against RegionExports.hpp static assertions.
    • Verified that null this checks via Checked / CheckedConst throw std::invalid_argument as required by C++ runtime bindings.
    • Verified identity checking logic in isIdentity() and 2D representability in isRepresentableIn2D() matching WebKit source behavior.
    • Verified 3D transformation matrix application in apply() with correct handling of percentage dimensions.
    • Verified blend() operation handling including blendToIdentity, mismatched types, shared primitive types, and progress-based interpolation in accordance with upstream Length::blend.
    • Verified AGENTS.md conventions: header license notices from upstream WebKit, NotImplemented_nid_no_patch stubs for calculated lengths, no forbidden comments, and debt documentation added to docs/dev/debt/changes/.

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5957328754 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22872#pullrequestreview-5957328754). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-18T13:16:28Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `6a7183d781`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_translatetransformoperation_tests` built cleanly. - **CTest** (`nkwebkit_translatetransformoperation`): ``` 1/1 Test #4580: nkwebkit_translatetransformoperation ... Passed 0.01 sec 100% tests passed, 0 tests failed out of 1 ``` - **Negative control**: with `core/libs/prx/libSceNKWebKit/Export.cpp`, `core/libs/prx/libSceNKWebKit/include/Api.hpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/include/RegionExports.hpp`, `core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp`, `core/libs/prx/libSceNKWebKit/src/TranslateTransformOperation.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified WebCore::TranslateTransformOperation guest ABI layout (16-byte base, 40-byte total size, m_x/m_y/m_z offsets at 16/24/32, and 8-byte TransformOperationRef) against RegionExports.hpp static assertions. - Verified that null `this` checks via Checked / CheckedConst throw std::invalid_argument as required by C++ runtime bindings. - Verified identity checking logic in isIdentity() and 2D representability in isRepresentableIn2D() matching WebKit source behavior. - Verified 3D transformation matrix application in apply() with correct handling of percentage dimensions. - Verified blend() operation handling including blendToIdentity, mismatched types, shared primitive types, and progress-based interpolation in accordance with upstream Length::blend. - Verified AGENTS.md conventions: header license notices from upstream WebKit, NotImplemented_nid_no_patch stubs for calculated lengths, no forbidden comments, and debt documentation added to docs/dev/debt/changes/. Looks Good To Me
MarcZX10 commented 2026-11-21 02:34:59 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T02:34:59Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change based on the code inspected; the optional points below concern behaviors the author identifies as unverified.

What I ran

Reviewed head 0e76b433111e510ab456bfa5426c0183cf781ba. No commands were run; repo_read.py was unavailable as a command in this interface. The description reports 155 of 155 nkwebkit_* tests passed and check_conventions.py passed; those results were not independently verified.

Results

Check Result Note
Source review passed Core implementation and changed headers inspected
Reported tests not run Author-reported only
Console and Windows not run Not verified

Findings

Blocking

None in the code inspected.

Non-blocking

  • The implementation intentionally throws for calculated lengths and for dump with an out-of-range operation type; the description and debt entry record these limits. The behavior is not compared against a console module.
  • The transform base layout and vtable behavior are also recorded as unverified against a console module.

Not verified

No build or tests were run. Console and Windows behavior were not verified. Export.cpp was listed as excluded for size and only its opening and closing lines were inspected; the export-removal hunks were reviewed in diff.patch. LegacyExports.hpp was not read in full; the changed declaration-removal hunks were reviewed in diff.patch. The full test file and other included files listed under reviewed were not all read. No claim is made about uninspected code.

Files read: review/description.md, review/commits.md, review/manifest.json, review/diff.patch; core/libs/prx/libSceNKWebKit/src/TranslateTransformOperation.cpp, core/libs/prx/libSceNKWebKit/tests/TranslateTransformOperation.cpp, core/libs/prx/libSceNKWebKit/include/RegionExports.hpp, core/libs/prx/libSceNKWebKit/include/WebCoreTransformExports.hpp, core/libs/prx/libSceNKWebKit/include/WebCoreLayoutExports.hpp, core/libs/prx/libSceNKWebKit/include/PerspectiveTransformOperationExports.hpp, core/libs/prx/libSceNKWebKit/src/WebCoreLayout.cpp, core/libs/prx/libSceNKWebKit/src/PerspectiveTransformOperation.cpp, core/libs/prx/libSceNKWebKit/tests/PerspectiveTransformOperation.cpp, core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/include/Api.hpp, and core/libs/prx/libSceNKWebKit/Export.cpp (partial).

Excluded from full text: core/libs/prx/libSceNKWebKit/Export.cpp (too large for the review folder); the changed declaration-removal hunks of Api.hpp and LegacyExports.hpp were checked in the diff. The other changed files are included in the bundle, but were not all read in full.

To get this to a good state

Nothing is required. Optional: compare the layout, vtable, and behavior with a console module when one is available.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6002291384 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/22872#pullrequestreview-6002291384). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T02:34:59Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change based on the code inspected; the optional points below concern behaviors the author identifies as unverified. ## What I ran Reviewed head `0e76b433111e510ab456bfa5426c0183cf781ba`. No commands were run; `repo_read.py` was unavailable as a command in this interface. The description reports 155 of 155 `nkwebkit_*` tests passed and `check_conventions.py` passed; those results were not independently verified. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Core implementation and changed headers inspected | | Reported tests | not run | Author-reported only | | Console and Windows | not run | Not verified | ## Findings ### Blocking None in the code inspected. ### Non-blocking - The implementation intentionally throws for calculated lengths and for `dump` with an out-of-range operation type; the description and debt entry record these limits. The behavior is not compared against a console module. - The transform base layout and vtable behavior are also recorded as unverified against a console module. ## Not verified No build or tests were run. Console and Windows behavior were not verified. `Export.cpp` was listed as excluded for size and only its opening and closing lines were inspected; the export-removal hunks were reviewed in `diff.patch`. `LegacyExports.hpp` was not read in full; the changed declaration-removal hunks were reviewed in `diff.patch`. The full test file and other included files listed under reviewed were not all read. No claim is made about uninspected code. Files read: `review/description.md`, `review/commits.md`, `review/manifest.json`, `review/diff.patch`; `core/libs/prx/libSceNKWebKit/src/TranslateTransformOperation.cpp`, `core/libs/prx/libSceNKWebKit/tests/TranslateTransformOperation.cpp`, `core/libs/prx/libSceNKWebKit/include/RegionExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WebCoreTransformExports.hpp`, `core/libs/prx/libSceNKWebKit/include/WebCoreLayoutExports.hpp`, `core/libs/prx/libSceNKWebKit/include/PerspectiveTransformOperationExports.hpp`, `core/libs/prx/libSceNKWebKit/src/WebCoreLayout.cpp`, `core/libs/prx/libSceNKWebKit/src/PerspectiveTransformOperation.cpp`, `core/libs/prx/libSceNKWebKit/tests/PerspectiveTransformOperation.cpp`, `core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/include/Api.hpp`, and `core/libs/prx/libSceNKWebKit/Export.cpp` (partial). Excluded from full text: `core/libs/prx/libSceNKWebKit/Export.cpp` (too large for the review folder); the changed declaration-removal hunks of `Api.hpp` and `LegacyExports.hpp` were checked in the diff. The other changed files are included in the bundle, but were not all read in full. ## To get this to a good state Nothing is required. Optional: compare the layout, vtable, and behavior with a console module when one is available.
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!22872
No description provided.