feat(libSceNKWebKit): implement basic CSS filter operation exports #24172

Merged
Nino4you merged 2 commits from upstream-pr/24172 into main 2026-11-21 12:19:59 +00:00
Nino4you commented 2026-11-20 09:05:40 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Nino4you on 2026-11-20T09:05:40Z.


What

Implement the ten unimplemented CSS basic filter operation exports for WebCore::BasicColorMatrixFilterOperation and WebCore::BasicComponentTransferFilterOperation in libSceNKWebKit, following pinned WebKit FilterOperation.h, FilterOperation.cpp, ColorMatrix.h, and AnimationUtilities.h at commit c55364d53f971f63a709976f168d932d558b8909:

  • WebCore::BasicColorMatrixFilterOperation (GRAYSCALE, SEPIA, SATURATE, HUE_ROTATE):
    • _ZN7WebCore31BasicColorMatrixFilterOperation6createEdNS_15FilterOperation13OperationTypeE
    • _ZN7WebCore31BasicColorMatrixFilterOperationC1EdNS_15FilterOperation13OperationTypeE
    • _ZN7WebCore31BasicColorMatrixFilterOperationC2EdNS_15FilterOperation13OperationTypeE
    • _ZNK7WebCore31BasicColorMatrixFilterOperation14transformColorERNS_5SRGBAIfEE
    • _ZN7WebCore31BasicColorMatrixFilterOperation5blendEPKNS_15FilterOperationEdb
  • WebCore::BasicComponentTransferFilterOperation (OPACITY, INVERT, CONTRAST, BRIGHTNESS):
    • _ZN7WebCore37BasicComponentTransferFilterOperation6createEdNS_15FilterOperation13OperationTypeE
    • _ZN7WebCore37BasicComponentTransferFilterOperationC1EdNS_15FilterOperation13OperationTypeE
    • _ZN7WebCore37BasicComponentTransferFilterOperationC2EdNS_15FilterOperation13OperationTypeE
    • _ZNK7WebCore37BasicComponentTransferFilterOperation14transformColorERNS_5SRGBAIfEE
    • _ZN7WebCore37BasicComponentTransferFilterOperation5blendEPKNS_15FilterOperationEdb

Removes the ten throwing stubs from Export.cpp and include/LegacyExports.hpp, declares the typed SysV signatures and 8-byte non-trivially-destructible WebCore::BasicFilterOperationRef<T> return wrapper in include/BasicFilterOperationExports.hpp (included from libSceNKWebKit.hpp), adds tests/BasicFilterOperations.cpp (nkwebkit_basicfilteroperations_tests), and records technical debt in docs/dev/debt/changes/feat-nkwebkit-basic-filter-operations.md.

Tested

Linux x86-64 (Debian 12, GCC 12.2.0, Ninja Release, BUILD_TESTING=ON), base upstream/main e825fa1492:

  • Compiled BasicFilterOperations.cpp.o, Export.cpp.o, tests/BasicFilterOperations.cpp.o, WtfMemory.cpp.o, and Bmalloc.cpp.o cleanly with 0 warnings (full libSceNKWebKit link on GCC 12.2 hits pre-existing DragImageAbi.hpp union default-constructor error).
  • Linked BasicFilterOperations.cpp.o + tests/BasicFilterOperations.cpp.o + WtfMemory.cpp.o + Bmalloc.cpp.o against libSceJsc.prx and libc.prx and ran the test binary: passed (exit 0; verified static signatures, create/C1/C2, vtable dispatch, all 8 filter types in transformColor including clamping and unrecognized types, blend for null/matching/blendToPassthrough/mismatched 16-byte header next to PROT_NONE guard page + refcount retain/release, and null/unmapped/read-only guest pointer rejection preserving errno).
  • ctest --test-dir build -R public_headers -V: 65/65 passed (public_headers audit + all 64 public_headers_compile_* batches).
  • python3 tools/debt_fold.py --check: passed.
  • python3 tools/check_test_registration.py build: passed.
  • python3 tools/check_conventions.py --base upstream/main: all conventions checks passed (0 errors, 0 warnings).
  • python3 tools/guest_pointer_audit.py libSceNKWebKit: 0 findings in BasicFilterOperations.cpp.
  • tools/pr_overlap.py --names (all 10 exports open: none) and tools/pr_overlap.py --branch feat/nkwebkit-basic-filter-operations: 0 overlapping exports or new files.
  • Not run: Windows, a console or a title.

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:5410695184 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24172). Originally posted by [Nino4you](https://github.com/Nino4you) on 2026-11-20T09:05:40Z. --- ### What Implement the ten unimplemented CSS basic filter operation exports for `WebCore::BasicColorMatrixFilterOperation` and `WebCore::BasicComponentTransferFilterOperation` in `libSceNKWebKit`, following pinned WebKit `FilterOperation.h`, `FilterOperation.cpp`, `ColorMatrix.h`, and `AnimationUtilities.h` at commit `c55364d53f971f63a709976f168d932d558b8909`: - `WebCore::BasicColorMatrixFilterOperation` (`GRAYSCALE`, `SEPIA`, `SATURATE`, `HUE_ROTATE`): - `_ZN7WebCore31BasicColorMatrixFilterOperation6createEdNS_15FilterOperation13OperationTypeE` - `_ZN7WebCore31BasicColorMatrixFilterOperationC1EdNS_15FilterOperation13OperationTypeE` - `_ZN7WebCore31BasicColorMatrixFilterOperationC2EdNS_15FilterOperation13OperationTypeE` - `_ZNK7WebCore31BasicColorMatrixFilterOperation14transformColorERNS_5SRGBAIfEE` - `_ZN7WebCore31BasicColorMatrixFilterOperation5blendEPKNS_15FilterOperationEdb` - `WebCore::BasicComponentTransferFilterOperation` (`OPACITY`, `INVERT`, `CONTRAST`, `BRIGHTNESS`): - `_ZN7WebCore37BasicComponentTransferFilterOperation6createEdNS_15FilterOperation13OperationTypeE` - `_ZN7WebCore37BasicComponentTransferFilterOperationC1EdNS_15FilterOperation13OperationTypeE` - `_ZN7WebCore37BasicComponentTransferFilterOperationC2EdNS_15FilterOperation13OperationTypeE` - `_ZNK7WebCore37BasicComponentTransferFilterOperation14transformColorERNS_5SRGBAIfEE` - `_ZN7WebCore37BasicComponentTransferFilterOperation5blendEPKNS_15FilterOperationEdb` Removes the ten throwing stubs from `Export.cpp` and `include/LegacyExports.hpp`, declares the typed SysV signatures and 8-byte non-trivially-destructible `WebCore::BasicFilterOperationRef<T>` return wrapper in `include/BasicFilterOperationExports.hpp` (included from `libSceNKWebKit.hpp`), adds `tests/BasicFilterOperations.cpp` (`nkwebkit_basicfilteroperations_tests`), and records technical debt in `docs/dev/debt/changes/feat-nkwebkit-basic-filter-operations.md`. ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Linux x86-64 (Debian 12, GCC 12.2.0, Ninja Release, `BUILD_TESTING=ON`), base `upstream/main` `e825fa1492`: - Compiled `BasicFilterOperations.cpp.o`, `Export.cpp.o`, `tests/BasicFilterOperations.cpp.o`, `WtfMemory.cpp.o`, and `Bmalloc.cpp.o` cleanly with 0 warnings (full `libSceNKWebKit` link on GCC 12.2 hits pre-existing `DragImageAbi.hpp` union default-constructor error). - Linked `BasicFilterOperations.cpp.o` + `tests/BasicFilterOperations.cpp.o` + `WtfMemory.cpp.o` + `Bmalloc.cpp.o` against `libSceJsc.prx` and `libc.prx` and ran the test binary: passed (exit 0; verified static signatures, `create`/`C1`/`C2`, vtable dispatch, all 8 filter types in `transformColor` including clamping and unrecognized types, `blend` for null/matching/`blendToPassthrough`/mismatched 16-byte header next to `PROT_NONE` guard page + refcount retain/release, and null/unmapped/read-only guest pointer rejection preserving `errno`). - `ctest --test-dir build -R public_headers -V`: 65/65 passed (`public_headers` audit + all 64 `public_headers_compile_*` batches). - `python3 tools/debt_fold.py --check`: passed. - `python3 tools/check_test_registration.py build`: passed. - `python3 tools/check_conventions.py --base upstream/main`: all conventions checks passed (0 errors, 0 warnings). - `python3 tools/guest_pointer_audit.py libSceNKWebKit`: 0 findings in `BasicFilterOperations.cpp`. - `tools/pr_overlap.py --names` (all 10 exports `open: none`) and `tools/pr_overlap.py --branch feat/nkwebkit-basic-filter-operations`: 0 overlapping exports or new files. - Not run: Windows, a console or a title. ### 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
PrivacyOnion commented 2026-11-20 09:07:43 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by PrivacyOnion on 2026-11-20T09:07:43Z.

Review: APPROVED


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

  • Conventions: tools/check_conventions.py passed.
  • Build: nkwebkit_basicfilteroperations_tests built cleanly.
  • CTest (nkwebkit_basicfilteroperations):
    1/1 Test #4663: nkwebkit_basicfilteroperations ...   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/LegacyExports.hpp, core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp, core/libs/prx/libSceNKWebKit/src/BasicFilterOperations.cpp reverted to main, the new tests do not build/link without the change; restoring it makes them build and pass.
  • Code reading:
    • Verified BasicColorMatrixFilterOperation and BasicComponentTransferFilterOperation vtable layouts, slot indices, and struct layouts match WebCore FilterOperation 24-byte layout on x86_64
    • Verified memory safety helpers ReadGuest, WriteGuest, and RetainGuest correctly validate guest pointer readability/writability via GuestCopyIn_nid_no_patch, GuestCopyOut_nid_no_patch, and GuestWritable_nid_no_patch while preserving errno via ErrnoGuard
    • Verified transformColor implementations for grayscale, sepia, hue-rotate, saturate, opacity, invert, contrast, and brightness against pinned WebKit ColorMatrix and FilterOperation formulas
    • Verified blend implementations handle null/mismatched from operations, blendToPassthrough mode, progress interpolation, and refcount management without leaking or premature freeing
    • Verified AGENTS.md compliance regarding no non-essential comments, debt fragment addition under docs/dev/debt/changes/, and removal of stubs from Export.cpp and LegacyExports.hpp

Looks Good To Me

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990097543 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24172#pullrequestreview-5990097543). Originally posted by [PrivacyOnion](https://github.com/PrivacyOnion) on 2026-11-20T09:07:43Z. **Review:** APPROVED --- Verified on Linux (Ubuntu 24.04, GCC 13.3, Ninja, Release) against `bbd9f6a80f`: - **Conventions**: `tools/check_conventions.py` passed. - **Build**: `nkwebkit_basicfilteroperations_tests` built cleanly. - **CTest** (`nkwebkit_basicfilteroperations`): ``` 1/1 Test #4663: nkwebkit_basicfilteroperations ... 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/LegacyExports.hpp`, `core/libs/prx/libSceNKWebKit/libSceNKWebKit.hpp`, `core/libs/prx/libSceNKWebKit/src/BasicFilterOperations.cpp` reverted to `main`, the new tests do not build/link without the change; restoring it makes them build and pass. - **Code reading**: - Verified BasicColorMatrixFilterOperation and BasicComponentTransferFilterOperation vtable layouts, slot indices, and struct layouts match WebCore FilterOperation 24-byte layout on x86_64 - Verified memory safety helpers ReadGuest, WriteGuest, and RetainGuest correctly validate guest pointer readability/writability via GuestCopyIn_nid_no_patch, GuestCopyOut_nid_no_patch, and GuestWritable_nid_no_patch while preserving errno via ErrnoGuard - Verified transformColor implementations for grayscale, sepia, hue-rotate, saturate, opacity, invert, contrast, and brightness against pinned WebKit ColorMatrix and FilterOperation formulas - Verified blend implementations handle null/mismatched from operations, blendToPassthrough mode, progress interpolation, and refcount management without leaking or premature freeing - Verified AGENTS.md compliance regarding no non-essential comments, debt fragment addition under docs/dev/debt/changes/, and removal of stubs from Export.cpp and LegacyExports.hpp Looks Good To Me
MarcZX10 commented 2026-11-20 09:23:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T09:23:09Z.

Review: COMMENTED


Reviewed — comments

Nothing blocks this; the points below are optional.

What I ran

Reviewed head bbd9f6a80f7b922e42e3c922cc5ff0907c9ab591 through the pinned repo_read.py reader; I did not run commands or tests. The author reports Linux x86-64 tests and checks in the PR description; those results were not independently verified. I read the full new implementation, API header, test file, debt note, and the changed include line. For Export.cpp and LegacyExports.hpp, I read the affected regions; Export.cpp was excluded from the review folder because it was too large.

Results

Check Result Note
Source review passed Targeted changed code inspected
Tests and build not run Results reported by author only
Console behavior not run ABI parity remains unverified

Negative control

Not run; this review session did not run tests or modify code under test.

Findings

Blocking

None.

Non-blocking

  • The PR records that console ABI, vtable layout, and floating-point parity remain unverified. Consider comparing these exports with a console module before treating the implementation as parity-confirmed (docs/dev/debt/changes/feat-nkwebkit-basic-filter-operations.md:5).

Sources

Not verified

I did not run the reported build, test binary, or other checks, and did not verify Windows, console, or title behavior. Export.cpp was read only around affected removals; LegacyExports.hpp was read around the affected declarations. The remaining changed code was read in full.

To get this to a good state

Nothing is required. Optional: compare the ABI, vtable layout, and floating-point behavior with a console module, then update the recorded debt if verified.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990328932 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24172#pullrequestreview-5990328932). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T09:23:09Z. **Review:** COMMENTED --- # Reviewed — comments Nothing blocks this; the points below are optional. ## What I ran Reviewed head `bbd9f6a80f7b922e42e3c922cc5ff0907c9ab591` through the pinned `repo_read.py` reader; I did not run commands or tests. The author reports Linux x86-64 tests and checks in the PR description; those results were not independently verified. I read the full new implementation, API header, test file, debt note, and the changed include line. For `Export.cpp` and `LegacyExports.hpp`, I read the affected regions; `Export.cpp` was excluded from the review folder because it was too large. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Targeted changed code inspected | | Tests and build | not run | Results reported by author only | | Console behavior | not run | ABI parity remains unverified | ## Negative control Not run; this review session did not run tests or modify code under test. ## Findings ### Blocking None. ### Non-blocking - The PR records that console ABI, vtable layout, and floating-point parity remain unverified. Consider comparing these exports with a console module before treating the implementation as parity-confirmed (`docs/dev/debt/changes/feat-nkwebkit-basic-filter-operations.md:5`). ## Sources - [Changed implementation at the reviewed head](https://github.com/boykopovar/AnyPS5/blob/bbd9f6a80f7b922e42e3c922cc5ff0907c9ab591/core/libs/prx/libSceNKWebKit/src/BasicFilterOperations.cpp) - [PR description and reported checks](https://github.com/boykopovar/AnyPS5/pull/24172) ## Not verified I did not run the reported build, test binary, or other checks, and did not verify Windows, console, or title behavior. `Export.cpp` was read only around affected removals; `LegacyExports.hpp` was read around the affected declarations. The remaining changed code was read in full. ## To get this to a good state Nothing is required. Optional: compare the ABI, vtable layout, and floating-point behavior with a console module, then update the recorded debt if verified.
MarcZX10 commented 2026-11-20 22:27:35 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T22:27:35Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change based on the source inspected; console ABI and floating-point parity remain unverified.

What I ran

Reviewed head c380286b9940228054c6e861ac6cd96e7be30ec6. I did not run commands or tests. The description reports Linux build and test results; those were not independently run.

Results

Check Result Note
Source review passed Implementations, ABI wrapper, and tests inspected
Build and tests not run Results are author-reported
Console behavior not run ABI and parity remain unverified

Findings

Blocking

None identified in the inspected code.

Non-blocking

  • Console ABI, vtable layout, and floating-point parity are explicitly unverified; compare against a console module before relying on these exports.

Not verified

No tests or builds were run. Windows, console, and title behavior were not verified. Read changed source and test logic, declarations, layout definitions, debt note, and relevant diff hunks. Export.cpp was excluded from the review folder because it was too large; its removal hunks were inspected in diff.patch. LegacyExports.hpp was 2,124 lines and only the relevant diff hunks and a context range were inspected. The test file was 567 lines; its new test cases were inspected in the diff, not as a full file.

To get this to a good state

Nothing is required. Optional: compare the ABI and floating-point behavior with a console module.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6000220884 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/24172#pullrequestreview-6000220884). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T22:27:35Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change based on the source inspected; console ABI and floating-point parity remain unverified. ## What I ran Reviewed head `c380286b9940228054c6e861ac6cd96e7be30ec6`. I did not run commands or tests. The description reports Linux build and test results; those were not independently run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Implementations, ABI wrapper, and tests inspected | | Build and tests | not run | Results are author-reported | | Console behavior | not run | ABI and parity remain unverified | ## Findings ### Blocking None identified in the inspected code. ### Non-blocking - Console ABI, vtable layout, and floating-point parity are explicitly unverified; compare against a console module before relying on these exports. ## Not verified No tests or builds were run. Windows, console, and title behavior were not verified. Read changed source and test logic, declarations, layout definitions, debt note, and relevant diff hunks. `Export.cpp` was excluded from the review folder because it was too large; its removal hunks were inspected in `diff.patch`. `LegacyExports.hpp` was 2,124 lines and only the relevant diff hunks and a context range were inspected. The test file was 567 lines; its new test cases were inspected in the diff, not as a full file. ## To get this to a good state Nothing is required. Optional: compare the ABI and floating-point behavior with a console module.
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!24172
No description provided.