feat(libSceNKWebKit): implement DefaultFilterOperation construction and InvertLightnessFilterOperation color exports #23080
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/23080"
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 FinleyLaempe on 2026-11-18T17:43:50Z.
What
Implements
WebCore::DefaultFilterOperation::create(WebCore::FilterOperation::OperationType), bothWebCore::DefaultFilterOperation(OperationType)constructors andWebCore::InvertLightnessFilterOperation::blend(const WebCore::FilterOperation*, double, bool),WebCore::InvertLightnessFilterOperation::transformColor(WebCore::SRGBA<float>&) constandWebCore::InvertLightnessFilterOperation::inverseTransformColor(WebCore::SRGBA<float>&) constin libSceNKWebKit, which were throwing stubs inExport.cpp.blendand the hueRotate/toDarkMode/toLightMode colour transforms, and FilterOperation.h forcreate. The newsrc/FilterOperation.cppcarries the Apple upstream notice, as AGENTS.md asks for adapted code.OperationTypeis a 32-bit enum (pinnedTypeisuint8_t), andblendtakes(const FilterOperation*, double, bool)instead of the pinnedBlendingContext&, ignoringprogressandblendToPassthroughas the pinned code ignoresBlendingContext&.WebCore::FilterOperation,WebCore::DefaultFilterOperationandWebCore::InvertLightnessFilterOperationguest records fromRegionExports.hpp, zero-filled with a refcount of 1 and a 12-slot library vtable; base slots (isIdentity,outsets,affectsOpacity,movesPixels,shouldBeRestrictedBySecurityOrigin, colour transforms onDefaultFilterOperation) return neutral defaults.WTF::fastMallocexport declared inWtfExports.hpp;createreturns a non-trivially-destructible 8-byteWTF::RefthroughWTF::adoptRef(RegionExports.hpp),blendaWTF::RefPtr<WebCore::FilterOperation>.cloneandoperator==of both classes stayNotImplemented_nid_no_patchinExport.cpp(declared inInventoryExports.hpp); the vtable clone and equals slots point at those exports, so dispatching through them throws, as the tests assert.InvertLightnessFilterOperationmethods throwstd::invalid_argumenton a nullthis. Colour transforms treat NaN components as 0 and clamp the result to [0, 1], mirroring the pinnedresolved()plusmakeFromComponentsClamping;blendreturnsthiswhenfromhas a different type, otherwise a freshInvertLightnessFilterOperation.RegionExports.hpp(main):FilterOperation::derefnow frees throughNKWebKit::Deallocateinstead ofstd::free, because main'sAllocateputs anAllocationHeaderin front of the pointer (src/Bmalloc.cpp), sostd::freeon it was a bug. The file also gains a host-sideWTF::RefPtr<T>template mirroring the existingWTF::Refforblend's return type.src/FilterOperation.cpppins the base offsets withoffsetofasserts but omits one for the non-standard-layoutDefaultFilterOperationbecause MinGW rejects that;sizeofasserts still pin both layouts (16/24 bytes).Export.cppandLegacyExports.hppinto the newinclude/FilterOperationExports.hpp, included fromlibSceNKWebKit.hpp.tests/FilterOperation.cppcoverscreatefor several represented types, both constructors, blend's same-type and different-type paths, the vtable dispatch and the colour transforms against the pinned matrices, including extended-range components, out-of-range alpha and NaN, plus the null-thisthrows.docs/dev/debt/changes/feat-nkwebkit-filter-operations.mdchanges the existing "[Filter operations]" debt entry, which said theFilterOperationsubclasses stay stubs, into one for the new file. It is marked "not compared with a console module", and notes that the console sret convention for the hiddenWTF::Ref/RefPtrresult pointers is unmeasured. These exports are not rows in the module's NID inventory table, so no rows are removed.FilterOperationmembers stay stubs.Tested
Arch Linux x86-64, GCC 16.2.1, Release build with
-DBUILD_TESTING=ON: the newnkwebkit_filteroperationtest and every othernkwebkit_*test, 143 of 143 passed.python3 tools/check_conventions.py --base upstream/mainpasses. Not tested on a console or on Windows.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 copilot-pull-request-reviewer[bot] on 2026-11-18T17:44:04Z.
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.
Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-18T17:46:23Z.
Review: APPROVED
Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against
9e5e5cd594:tools/check_conventions.pypassed.nkwebkit_filteroperation_testsbuilt cleanly.nkwebkit_filteroperation):core/libs/prx/libSceNKWebKit/Export.cpp,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/FilterOperation.cppreverted tomain, the new tests do not build/link without the change; restoring it makes them build and pass.Looks Good To Me