feat(libSceNKWebKit): implement WebCore filter operations #16510
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/16510"
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 gslashm on 2026-11-06T23:28:45Z.
What
Implements 40
libSceNKWebKitexports fromSource/WebCore/platform/graphics/filters/FilterOperation.cpp:46-550, the inline parts ofFilterOperation.h:66-377, theLengthmove and equality rules atSource/WebCore/platform/Length.h:232-315and theFilterOperationsprinter inFilterOperations.cpp:220-232at80f77e94c6:BlurFilterOperation:create, both constructors,D0,D1,D2,clone,operator==,stdDeviationDropShadowFilterOperation:create, both constructors,D0,D1,D2,clone,operator==,x,y,location,stdDeviation,colorInvertLightnessFilterOperation:create, both constructors,clone,operator==DefaultFilterOperation:representedType,clone,operator==BasicColorMatrixFilterOperation:clone,operator==,amount,passthroughAmountBasicComponentTransferFilterOperation:clone,operator==,amount,passthroughAmount,affectsOpacityoperator<<(WTF::TextStream&, const FilterOperations&)The 41st export,
operator<<(WTF::TextStream&, const FilterOperation&), is implemented for 14 of the 15 types, but its drop-shadow case needsoperator<<(WTF::TextStream&, const IntPoint&)(held by open #15517) andoperator<<(WTF::TextStream&, const Color&)(still a stub), so it callsNotImplemented_nid_no_patchthere and remains a pending export.src/FilterOperation.cppcarries three notices, each with its ownDerived fromline:FilterOperation.cppandFilterOperation.h(BSD) andLength.h(LGPL-2+), becauseCopyLengthandLengthsEqualare ports ofLength::initialize(Length&&)andLength::operator==.src/FilterOperations.cppcarries theFilterOperations.cppnotice.The objects are polymorphic, and the inventory exports no
_ZTVsymbol, so a guest cannot build one inline: every object comes from this library, which installs host vtables laid out from the pinned header in theValueVtableStorageform ofsrc/WtfJson.cpp(offset-to-top 0, null typeinfo, 12 slots).createandclonereturnRef<FilterOperation>through the hidden sret pointer andblendreturnsRefPtr<FilterOperation>the same way;Lengthis passed tocreateand to the constructors by invisible reference;location()returnsIntPoint(8 bytes) inrax;outsets()returnsIntOutsets(fourints) inrax:rdx.Behaviour that differs from upstream, all in the debt file:
Lengththrows, because~Lengthwould call the unimplementedLength::deref.Colorthrows, through the existingColorcopy constructor.blendoverrides of the four amount classes, theirtransformColor,InvertLightnessFilterOperation'stransformColorandinverseTransformColor,BlurFilterOperation::isIdentity, and the blur and drop-shadowoutsetsthrow throughNotImplemented_nid_no_patch: they needLengthblending, the color matrices,ColorBlendingandFEGaussianBlur/FEDropShadow.NotImplemented_nid_no_patchbefore writing anything, for the missing printers above.main'sTextStreamexports, so it inherits #14172's 40-byteWTF::StringBuilderrather than the 24-byte one at the pin. This PR does not settle that.self,other,streamor argument pointer throwsstd::invalid_argument.D0,D1andD2ofDefaultFilterOperation,InvertLightnessFilterOperation,BasicColorMatrixFilterOperationandBasicComponentTransferFilterOperationalready existed (#13947'sjmp fastFreeforD0, #13930's emptyD1/D2), so their vtable slots reproduce the same behaviour.D0ofBlurFilterOperationandDropShadowFilterOperationis new; theirD1/D2do nothing, because a non-calculatedLengthand an inlineColorneed no destruction.Not compared with a console module.
tools/pr_overlap.pylists #13486 under the same exports. It is a relinker draft whose merge base87755c8519(head0bde10d243, 2026-10-30) predates the 8703 stubs, so its diff re-adds them, including these 41, all still throwingNotImplemented_nid_no_patch; it implements none of them. The scan ran at 2026-11-06 23:15 UTC against 1840 open PRs: no open PR adds the same files. #16509, opened five minutes before this PR, implements 7 of the 41 getters; it is listed underDepends on, and the 80 PRs the tool could not merge withmainwere compared separately and hold none of the 41 names. One of them, #15011, merged while this PR was open; it holds none of these names, and rebasing onto it conflicted only on the debt count line. Line conflicts are theFilter operationsentry this replaces (docs/dev/debt/libSceNKWebKit.md:50), the debt count line (:66), the include inlibSceNKWebKit.hpp:22, and the deleted stub ranges inExport.cppandinclude/InventoryExports.hpp. Whichever merges later keeps both sides.Update (2026-11-08): rebased onto
main80057dddd2. #16509 implements the 7 filter-operation getters above as measured field reads. This branch keeps its implementations until #16509 merges, then drops those 7 and rebases.Tested
Windows 11 Pro, WinLibs GCC 15.2.0. No title and no console module.
nkwebkit_filteroperationchecks the member offsets and vtable slots, construction and theLengthmove, calculated-Lengthand out-of-line-Colorrejection,clonereference counts, every equality rule including NaN andLengthquirks, bothpassthroughAmounttables andaffectsOpacity, theisIdentityslots, the constant slots againstConstantExports.cpp, theblendand throwing slots,D0of all six classes, printing of every type and of aFilterOperationslist (including a list holding a drop-shadow, which throws after writing the earlier entries), and a null-pointer throw for every pointer argument of the exports that take one, first and later alike.ctest -R nkwebkit: 31 of 31 pass.ctest -R public_headers: 65 of 65 pass.tools/progress.py --module libSceNKWebKit: 1964 of 10982, 40 more thanmain's 1924. Whole suite not run.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)Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T10:57:17Z.
Review: CHANGES_REQUESTED
Reviewed — comments
Changes are required before merge: correct the new vtable’s behavior for default filter operations before relying on objects created by this library.
What I ran
Reviewed head
a82f458a8eefd0ae68ccc66a64e8d0508aae25a6. No commands or tests were run; I inspected the prepared diff and used the pinned repository reader for targeted source ranges.Results
Findings
Blocking
core/libs/prx/libSceNKWebKit/src/FilterOperation.cpp:198: theDefaultFilterOperationvtable’sisIdentityslot always returnsfalse. A default operation represents a filter type with no explicit operation; the pinned WebKit behavior treats it as an identity operation. Consumers dispatching this slot will therefore treat an identity filter as active. Implement the type-specific identity result (or use the pinned implementation) instead of returning a constant.Non-blocking
core/libs/prx/libSceNKWebKit/src/FilterOperation.cpp:754: the invert-lightness blend override ignores its blending context and returns a newly created operation whenever the source type matches. The PR description acknowledges that this path differs from upstream and does not list it among the throwing debt paths; consider matching the pinned blend semantics or explicitly making this path throw until implemented.Not verified
No tests or build checks were run, and no console module comparison was made. The review bundle excluded the full text of
Export.cppandinclude/InventoryExports.hppbecause they were too large; I inspected their relevant changes indiff.patch. The test file and other changed files were not read in full. The reviewed manifest lists 10 changed files; targeted reads covered the filter implementation, ABI header, and relevant diff hunks.To get this to a good state
Fix the
DefaultFilterOperationidentity slot, then run the targetednkwebkit_filteroperationchecks and confirm the result against the pinned behavior.Pull request closed