feat(libSceNKWebKit): implement identity, rotate, scale, skew, matrix and matrix3d transform operations #18395
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18395"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by SHOnnay on 2026-11-11T13:23:12Z.
What
Implements 95 of the 130 throwing
WebCore::*TransformOperationexports in libSceNKWebKit: Identity, Rotate, Scale, Skew, Matrix and Matrix3D.Exports, per class:
createoverloadapply(TransformationMatrix&, const FloatSize&)blend(const TransformOperation*, double, bool)clone,operator==,isIdentity,dumpisAffectedByTransformOrigin/isRepresentableIn2Dwhere exportedAccessors: Rotate
x/y/z/angle, Scalex/y/z, SkewangleX/angleY, Matrix3Dmatrix.Depends on #18377. This branch is stacked on it, so the diff includes its commit until it merges. Rotate's general-axis blend and Matrix3D use its
TransformationMatrixblend/decompose4.Source. Pinned WebKit
c55364d53f97, the revision whose declarations match these mangled names:Source/WebCore/platform/graphics/transforms/*TransformOperation.{h,cpp}TransformOperation.{h,cpp}WTF/wtf/RefCounted.hAll 95 mangled names were checked against those declarations.
Layout (
WebCoreTypes.hpp).TransformOperationbase: vptr, 32-bit refcount, 4-byteOperationTypeat offset 12, followed by the derived structs.MatrixTransformOperationis rebased onto it. Itsuint8_ttype plus padding becomes the 4-byte enum; its size is unchanged and asserted.TransformOperation.hdeclaration order under Itanium, without RTTI: D1, D0, clone, ==, isIdentity, apply, blend, isAffectedByTransformOrigin, isRepresentableIn2D, dump.Allocation and returns. Objects are allocated with
fastMalloc, freed by D0, andRefresults return through the hidden result pointer, as in #16510.Files.
include/TransformOperationExports.hpp,src/TransformOperationAbi.hpp,tests/TransformOperation.cpp.src/WebCoreTransform.cpp.LegacyExports.hpp, 2 inApi.hpp, 3 inInventoryExports.hpp.Left throwing (35): all Translate and Perspective exports. They take
WebCore::Length. PinnedLength.hplacesm_hasQuirkat 4 andm_typeat 5 and has noContenttype, while this library'sLength(RegionExports.hpp) follows the PS5 11.x order. Calculated lengths would also need the unmodelledCalculationValueMap.Debt file. Records that gap, plus the unverified vtable order, object layout and
Refreturn. Throw counts are lowered and the 3createtable rows removed.Tested
macOS 27 on Apple M1. The new
nkwebkit_transformoperationtest is registered by the library's test glob. It is a full-build test and was not run: the full build does not run on macOS. A Linux or Windows run is needed.Harness. A temporary host harness, not committed, built the unchanged production sources with the test functions copied verbatim.
WebCoreGeometrytests still pass.static_assertinlibc/include/GuestLongDouble.hppfails there; this change does not cause it.Mutation check. All 5 hand mutations failed the harness:
create(dd)setting z=0Syntax.
clang++ -arch x86_64 -fsyntax-onlypasses on every changed .cpp.Overlap. No open PR implements these exports.
pr_overlap.pyfound no shared exports among the pull requests it could merge. It could not compare 59 that conflict withmain.TransformOperation, in context lines or the existingMatrixTransformOperationsize assert.WebCoreTypes.hpp) and with #17695/#17907 (adjacentExport.cpp/LegacyExports.hpplines).Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Summary by CodeRabbit
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-19T06:24:40Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: reject singular 3D transforms during decomposition before blending them.
What I ran
Reviewed head
c0292804fecb4804d05a383abf0b2c28f01e99c8and the prepared diff; no commands or tests were run.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp:479:Decompose4divides byscaleYandscaleZwithout rejecting zero scales, and earlier normalizes rows without guarding a zeroscaleX. A singular 3D matrix (for example, a matrix with a zero scale axis) can therefore feed NaN or infinity into the quaternion and interpolation path inblend4, then be returned as the blended transform. Detect the degenerate decomposition and take the existing fallback path before these divisions.Non-blocking
None.
Sources
WebCoreTransform.cppat the reviewed head contains the decomposition divisions andblend4caller.WebCoreGeometry.cppat the reviewed head exercises regular 3D blending but does not cover a zero-scale matrix in the blend test.Not verified
Read the changed source and test files plus the review description, commit list, manifest, and diff.
Export.cppandInventoryExports.hppwere excluded from the review bundle as too large; their relevant patch hunks were inspected. The contents offiles.jsonwere unavailable. I did not run the project tests or verify vtable order, object layout,Refreturn ABI, or console behavior.To get this to a good state
Guard decomposition against zero-length axes and add a singular 3D blend regression test; then run the registered tests on a supported build environment.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T07:46:52Z.
Review: COMMENTED
Reviewed — comments
This review covers the transform operation implementation at head
34a5be229abe42c273d72e17b164b7989f2215e6; the library test was not run in this environment.What I ran
No build or tests were run. I read the prepared description, commits, manifest, diff, and selected implementation and test ranges using
repo_read.py.Results
Findings
Blocking
None.
Non-blocking
core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp:1766— The general-axis rotate blend ignoresDecompose4's return value and then uses the output quaternion. If a blended matrix cannot be decomposed, the decomposition routine can return false without filling the quaternion, resulting in an invalid axis/angle. Handle failure with a defined fallback (such as returning the nearer endpoint) and cover a singular or otherwise undecomposable blend input.Not verified
Export.cppandInventoryExports.hpp; they were excluded from the review folder due to size. The changed sections are represented indiff.patch.description.md,commits.md,manifest.json,diff.patch,TransformOperationAbi.hpp,WebCoreTransform.cpp, andTransformOperation.cpp.files.jsonis unavailable; the prepared file listing says 15 files are reviewed. The source files listed above are only a partial read of that set.To get this to a good state
Nothing is required. Please consider adding a failure path and regression coverage for general-axis blending when matrix decomposition fails.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T11:02:01Z.
Review: CHANGES_REQUESTED
Reviewed — changes requested
Changes are required before merge: handle singular 3D matrices during decomposition so matrix blending cannot produce non-finite values.
What I ran
Reviewed head
72f56d03a0d8d92e03fac6bac6d2e654065a24ce. No tests or builds were run by me; the description reports a temporary host harness, while the registered full-build test was not run.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp:2472:Decompose4divides skew values byscaleYandscaleZwithout checking for zero. A singular matrix such as a 3D scale withscaleY == 0reaches this code; the decomposition can contain NaN, whichblend4then writes into the interpolated matrix. Guard zero-length rows and return a defined failure or decomposition result before dividing.Non-blocking
None.
Not verified
The full-build test and physical-console behavior were not verified. I did not read the full text of every changed file. The prepared manifest marks
Export.cppandInventoryExports.hppas excluded for size;files.jsonwas not available through the reader. Targeted review covered the new transform implementation andWebCoreTypes.hpp; other changed files were not inspected in full.To get this to a good state
Handle zero scale rows in
Decompose4, then run the registered transform-operation test on a supported build environment and include a singular-matrix blend case.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-22T14:14:05Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: ensure singular matrices are rejected when their determinant is zero.
What I ran
Reviewed head
c5242bacd0c9087ac2d590a37751334daec338ecfrom the prepared diff and pinned source reader (repo_read.py). No build or tests were run; the description reports the registered test was not run.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp:296—InverseMatrixrejects only determinants with absolute value belowkSmallNumber; when the determinant is exactly zero, it divides the adjugate by zero and returns success. The generalinverse()path then marks the optional result engaged atcore/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp:1234-1238, yielding an invalid inverse for a singular matrix. Reject zero determinants as well.Non-blocking
None.
Not verified
The full registered test, console behavior, and the host vtable/layout/
RefABI assumptions were not verified. The PR description reports host harness and syntax checks, but these were not run in this review.Export.cppandinclude/InventoryExports.hppwere excluded from the prepared full-text bundle as too large; their changed hunks were present in the diff, but their full contents were not read. Other changed-file contents were available through the review bundle or reader; I focused source reads on the changed transform implementation, ABI layout, and associated transform tests.To get this to a good state
Reject a zero determinant in
InverseMatrix, then run the registered transform test and verify the inverse behavior for singular matrices.Imported from boykopovar/AnyPS5. Originally posted by coderabbitai[bot] on 2026-11-28T04:30:36Z.
Review: COMMENTED
Actionable comments posted: 6
178a6b6d-0953-43ff-8ca9-b11cc448c9c2Reviewing files that changed from the base of the PR and between
e1629f7e9aandd0d612f673.core/libs/prx/libSceNKWebKit/Export.cppcore/libs/prx/libSceNKWebKit/include/Api.hppcore/libs/prx/libSceNKWebKit/include/InventoryExports.hppcore/libs/prx/libSceNKWebKit/include/LegacyExports.hppcore/libs/prx/libSceNKWebKit/include/PerspectiveTransformOperationExports.hppcore/libs/prx/libSceNKWebKit/include/TransformOperationExports.hppcore/libs/prx/libSceNKWebKit/include/WebCoreExports.hppcore/libs/prx/libSceNKWebKit/libSceNKWebKit.hppcore/libs/prx/libSceNKWebKit/src/PerspectiveTransformOperation.cppcore/libs/prx/libSceNKWebKit/src/TransformOperationAbi.hppcore/libs/prx/libSceNKWebKit/src/WebCoreTransform.cppcore/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppcore/libs/prx/libSceNKWebKit/tests/PerspectiveTransformOperation.cppcore/libs/prx/libSceNKWebKit/tests/TransformOperation.cppcore/libs/prx/libSceNKWebKit/tests/WebCoreGeometry.cppdocs/dev/debt/changes/feat-nkwebkit-transform-3d.mddocs/dev/debt/changes/feat-nkwebkit-transform-operations.mdIncluded review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-28T08:36:40Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the implementation adds the described transform operations and matrix support, but ABI assumptions and the committed full-build test still need confirmation on a supported build host.
What I ran
Reviewed head
d0d612f67359dd5f0e4a09e7007dadbb9596165cagainst the prepared diff and targeted source ranges usingrepo_read.py. No commands or tests were run in this review. The PR description reports a temporary Rosetta harness and syntax/convention checks; those results were not independently run here.Files read:
review/description.md,review/commits.md,review/manifest.json,review/diff.patch,src/WebCoreTransform.cpp(lines 1–300),src/WebCoreTypes.hpp(lines 150–250),src/TransformOperationAbi.hpp(all 114 lines), andtests/TransformOperation.cpp(lines 1–100). Other changed files were not read in full.Export.cppis excluded from the review bundle because it is too large;files.jsonwas unavailable through the reader.Results
Findings
Blocking
None.
Non-blocking
TransformOperationAbi.hpp, but target-console layout and vtable compatibility were not verified here. Please confirm these assumptions with target ABI evidence before relying on runtime virtual dispatch. The PR description also identifies this as unverified.Not verified
I did not read the full text of all changed files, including
Export.cpp, the export headers, the remainingWebCoreTransform.cppimplementation,WebCoreGeometry.cpp, and the debt fragments. I did not inspect repository callers or compare implementation details against the pinned upstream sources. Consequently, behavior outside the inspected ranges and target-console ABI behavior remain unverified. No hardware or console test was run.To get this to a good state
Nothing is required. Optional points: verify the ABI assumptions on the target and run the registered test on a supported build host.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-29T16:26:08Z.
Review: COMMENTED
Reviewed — no blocking findings
The inspected transform-operation code has no verified blocking defect;
dumplabelsOperationType::ScaleZasscaleX, so its diagnostic output is incorrect.What I ran
No commands or tests were run. I read the prepared description, commit list, manifest, and diff, then inspected selected implementation, ABI, type, and test ranges at head
e7c489c803a64bab5719e379801bab4fb49cd947usingrepo_read.py.Results
Findings
Blocking
None identified in the code inspected.
Non-blocking
core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp:1522mapsOperationType::ScaleZto"scaleX". This makesdump()report the wrong transform operation; use"scaleZ".Not verified
The review is incomplete. I read selected ranges of
WebCoreTransform.cpp,TransformOperationAbi.hpp,WebCoreTypes.hpp, andtests/TransformOperation.cpp, plus the prepared review materials. I did not read every file listed as reviewed in the manifest, including the remaining changed implementation and test ranges;Export.cppis excluded from the review folder and was not inspected through the reader. I did not run the reported syntax checks, conventions check, public-header audit, or host harness. Other changed files and behaviors remain unverified.To get this to a good state
Nothing is required. Optional: correct the
ScaleZdump label.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:02:21Z.
Review: COMMENTED
Built the changed sources and ran
PerspectiveTransformOperation,TransformOperation, andWebCoreGeometryon Linux against the existing runtime. All three fixtures passed.AI-assisted: yes.
Pull request closed