feat(libSceNKWebKit): implement 3D TransformationMatrix inverse, scale, rotation and blending #18377
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/18377"
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-11T12:55:12Z.
What
Implements the six
WebCore::TransformationMatrixexports that still threw. With them, CSS 3D transforms can be inverted and animated:inverse() constscale3d(double, double, double)rotate3d(double x, double y, double z, double angle)blend,blend2andblend4(const TransformationMatrix&, double)Source revision. The newer pinned PS5-WebKit-11.x declares
blend(const TransformationMatrix&, double, CompositeOperation), so its mangled name differs from the exported_ZN7WebCore20TransformationMatrix5blendERKS0_d. The port therefore follows WebKitc55364d53f97, already pinned elsewhere in this library's debt file. Its signatures match all six exported names.inverseABI. At that revision it returnsWTF::Optional<TransformationMatrix>. ThatOptionalstoresbool init_before its storage (Optional.h), the reverse ofstd::optional. On x86-64,Matrix4is 16-byte aligned (TRANSFORMATION_MATRIX_USE_X86_64_SSE2, already reflected byalignas(16)here). The newOptionalTransformationMatrixis therefore{bool; pad; matrix at 16}, 144 bytes, returned through the hidden pointer. Static asserts pin the size and offset.Port. The bodies are ported line for line:
scale3drotate3d: major-axis fast paths, a zero axis leaves the matrix unchangedinverse: identity and translation, affine, and adjoint/determinant paths, with the sameSMALL_NUMBERthreshold as the existingisInvertibledecompose2anddecompose4, including the identity shortcut that leavesquaternionWat 0 in both pinned revisionsslerp,recompose2,recompose4blend's affine/3D dispatch, and the fallback when a matrix can't be decomposed:fromifprogress < 0.5, otherwise unchangedMatrix products reuse the existing scalar
multiply, not WebKit's x86-64 SSE2 path. That gap and the unverifiedOptionallayout are recorded indocs/dev/debt/libSceNKWebKit.md. The six stubs and theirLegacyExports.hppplaceholders are removed.Tested
macOS 27 on Apple M1. The
nkwebkit_*tests are full-build tests, and the full build does not run on macOS, so the registered test was not run. It needs a Linux or Windows run.Harness. A temporary host harness, not committed, compiled the unchanged
src/WebCoreTransform.cppwith these copied verbatim fromtests/WebCoreGeometry.cpp: the newTestTransformationMatrixScale3dAndAxisRotation,TestTransformationMatrixInverseandTestTransformationMatrixBlend, plus the existingTestTransformationMatrix. It passed on x86-64 under Rosetta (Apple clang,-O2) and on arm64. The expectations are hand-derived, not taken from the port:[0.5, 0.25, -1.5, -0.5]and exact negated translation.M·M⁻¹andM⁻¹·Mequal identity within 1e-12 for a rotated, scaled, perspective matrix. Singular affine and singular 4x4 matrices are disengaged.rotate3d. 120° about (1,1,1) permutes the axes. Non-unit major axes equal the Eulerrotate3d. A zero axis is a byte-identical no-op.blend.m34midpoint.m44 = 0takesfrombelow 0.5 and stays unchanged above it.Syntax.
clang++ -arch x86_64 -fsyntax-onlypasses ontests/WebCoreGeometry.cppandExport.cpp.pr_overlap.pyfound no overlap among the 112 pull requests it could merge. It could not compare 59 that conflict withmain. None of their diffs mentions any of the six exports orOptionalTransformationMatrix. #14138 also editsWebCoreTransform.cpp(other functions), so a textual conflict is possible. #17643 implementsapplyPerspective, a different export.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
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T16:22:49Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
0dae6ed0a6:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcoregeometry_testsbuilt cleanly.nkwebkit_webcoregeometry):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreExports.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Adjoint(),result[3][1]is computed asDeterminant3x3(a1, a3, a4, b1, b3, b4, c1, c2, c4);. Cofactors in column 1 omit row 2 (a2, b2, c2, d2) and must consist strictly of rows 1, 3, and 4. Passingc2instead ofc3incorporates row 2 instead of row 3 for columnc, producing an invalid adjoint matrix and corrupting general 4x4 matrix inversion inInverseMatrix()andTransformationMatrix::inverse().Decompose4(), the return value ofInverseMatrix(perspective, inversePerspective)is ignored. IfInverseMatrixfails due to a singular or near-singular perspective matrix (|det| < kSmallNumber), it returnsfalseleavinginversePerspectiveincomplete, butDecompose4()proceeds with undefined/corrupted perspective values instead of returningfalse.What,Tested,Depends on(#N or none),Fixes(Fixes #N or none),Unblocks(title ID and discussion, or none),GPUs tested(otherwise n/a), andAI-assisted(yes or no). The PR body deletedDepends on,Fixes,Unblocks,GPUs tested, andAI-assistedsections, and stripped the template checklist.Generated withfooter from the description; the AI-assisted checkbox can stay.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-11T18:41:34Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
0dae6ed0a6:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcoregeometry_testsbuilt cleanly.nkwebkit_webcoregeometry):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreExports.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Generated withfooter from the description; the AI-assisted checkbox can stay.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T06:13:02Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
584bda01cb:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcoregeometry_testsbuilt cleanly.nkwebkit_webcoregeometry):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreExports.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Generated withfooter from the description; the AI-assisted checkbox can stay.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T08:28:37Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
65a5e33ac1:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcoregeometry_testsbuilt cleanly.nkwebkit_webcoregeometry):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreExports.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Generated withfooter from the description; the AI-assisted checkbox can stay.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-12T13:34:24Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
35178bafb9:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcoregeometry_testsbuilt cleanly.nkwebkit_webcoregeometry):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreExports.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Generated withfooter from the description; the AI-assisted checkbox can stay.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T05:08:23Z.
Review: CHANGES_REQUESTED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
9dde1ef466:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcoregeometry_testsbuilt cleanly.nkwebkit_webcoregeometry):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreExports.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Generated withfooter from the description; the AI-assisted checkbox can stay.Requesting changes for the points above.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-15T19:16:47Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
9dde1ef466:tools/check_conventions.pypassed;git diff --checkclean.nkwebkit_webcoregeometry_testsbuilt cleanly.nkwebkit_webcoregeometry):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreExports.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-19T06:44:33Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
d59c54743a:tools/check_conventions.pypassed.nkwebkit_webcoregeometry_testsbuilt cleanly.nkwebkit_webcoregeometry):core/libs/prx/libSceNKWebKit/Export.cpp,core/libs/prx/libSceNKWebKit/include/LegacyExports.hpp,core/libs/prx/libSceNKWebKit/include/WebCoreExports.hpp,core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp,core/libs/prx/libSceNKWebKit/src/WebCoreTypes.hppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T04:40:34Z.
Review: DISMISSED
Reviewed — changes requested
Changes are required before merge: guard 3D decomposition against zero scale axes and preserve the input when decomposition is singular.
What I ran
Reviewed head
d59c54743a82b7e56ee2cb4dd0ba4b5dcd70a08eusing the prepared diff andrepo_read.py. No commands or tests were run by me.Results
Findings
Blocking
Decompose4divides byscaleYandscaleZwithout checking for zero, then returns success. A singular 3D transform such asscale3d(1, 0, 1)therefore produces non-finite skew/quaternion data;blend4proceeds to compose it into the target. Return failure for degenerate axes soblend4follows its existing fallback.core/libs/prx/libSceNKWebKit/src/WebCoreTransform.cpp:372Non-blocking
None.
Not verified
core/libs/prx/libSceNKWebKit/Export.cppwas excluded from the review bundle because it is too large; its removal hunk is visible indiff.patch, but its full text was not read.OptionalTransformationMatrixlayout remain unverified, as recorded in the PR description.Files read:
description.md,commits.md,manifest.json,diff.patch,README.md,WebCoreExports.hpp,WebCoreTransform.cpp,WebCoreTypes.hpp, andWebCoreGeometry.cpp.LegacyExports.hppand the fullExport.cppwere not read;files.jsonwas not available in the review folder. The changed line ranges ofWebCoreTransform.cppandWebCoreGeometry.cppwere not all read.To get this to a good state
Guard zero-length axes in
Decompose4, add regression coverage for blending a singular matrix with a valid one, and run the registered test on a supported build environment.Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T13:17:26Z.
Review: COMMENTED
Built the change against the integration checkout on Linux. The registered WebCore geometry CTest passed, including the matrix inverse and transform cases.
AI-assisted: yes.
Pull request closed