feat(libSceFreeType): implement FT_Outline_Render #10609

Merged
MarcZX10 merged 9 commits from upstream-pr/10609 into main 2026-11-07 17:25:11 +00:00
MarcZX10 commented 2026-10-24 12:37:16 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-24T12:37:16Z.


What

Adds FT_Outline_Render to libSceFreeType, following the bundled FreeType 2.13.3 (ftoutln.c) with an LP64 FT_Raster_Params layout (new GuestRasterParams, 96 bytes, with a layout assertion). The outline is rendered from a native copy; a bitmap target is rendered into in place; a gray_spans callback is invoked with the native spans through a small trampoline that uses the guest's calling convention, so the direct mode works on every host; clip_box is converted only when the clip flag is set and written back in direct mode, as the native call does; source is set to the guest outline. black_spans, bit_test and bit_set throw because the native renderer does not use them. A guest coordinate outside the host FT_Pos range throws (Windows only). Console signature, parameter layout and errors are unverified; the debt entry says so.

Commits: implementation, test, debt entry.

Tested

Original PR head 4f3614e2cd5f7eadc1b9d9599fe84f810ce6b92a: Windows 11 Pro 10.0.26300, x86-64, WinLibs MinGW-w64 GCC 15.2.0 r7 (UCRT, POSIX threads), Ninja, Release. A reviewer built guest_freetype_outline_render_tests and neighboring FreeType tests. The default Windows CTest invocation for this target failed before test execution with 0xc0000135 because its DLL directory was missing from PATH; prepending build/core/libs/libs/unpatched made four focused FreeType suites pass 3/3 each. This PR adds the same target-directory PATH setup to the new CTest registration. These Windows runs were on the original head, before this follow-up.

This follow-up adds gray and monochrome negative-pitch comparisons and preserves output parameters on native errors. Local CMake configuration was attempted after initializing SDL2, but could not complete because other dependency submodules (FFmpeg, libusb, zstd, Opus, glslang and LibAtrac9) are unavailable or uninitialized in this worktree; the new regressions were not run locally. python3 tools/check_conventions.py --base upstream/main --head HEAD and git diff --check pass for the follow-up. Hosted product test jobs were skipped on the original head; checks for the updated head are pending. No title or GPU validation was run.

Current head b987789b00: Linux x86-64, GCC, full CMake build (Ninja, Release) of guest_freetype_outline_render_tests, which passes. This host fails the startup CPU-feature gate, so the binary was run in a throwaway build copy with that check disabled; nothing of that is in the branch. As a negative control, putting the old tracked-write range back (moved back by pitch * (rows - 1)) makes the test fail at its tracked-write check. The public header audit and all 64 public_headers_compile_* batches pass. Windows was not run.

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
  • 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:4995438787 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10609). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-24T12:37:16Z. --- ### What Adds `FT_Outline_Render` to libSceFreeType, following the bundled FreeType 2.13.3 ([ftoutln.c](https://github.com/freetype/freetype/blob/42608f77f20749dd6ddc9e0536788eaad70ea4b5/src/base/ftoutln.c)) with an LP64 `FT_Raster_Params` layout (new `GuestRasterParams`, 96 bytes, with a layout assertion). The outline is rendered from a native copy; a bitmap target is rendered into in place; a `gray_spans` callback is invoked with the native spans through a small trampoline that uses the guest's calling convention, so the direct mode works on every host; `clip_box` is converted only when the clip flag is set and written back in direct mode, as the native call does; `source` is set to the guest outline. `black_spans`, `bit_test` and `bit_set` throw because the native renderer does not use them. A guest coordinate outside the host `FT_Pos` range throws (Windows only). Console signature, parameter layout and errors are unverified; the debt entry says so. Commits: implementation, test, debt entry. ### Tested Original PR head `4f3614e2cd5f7eadc1b9d9599fe84f810ce6b92a`: Windows 11 Pro 10.0.26300, x86-64, WinLibs MinGW-w64 GCC 15.2.0 r7 (UCRT, POSIX threads), Ninja, Release. A reviewer built `guest_freetype_outline_render_tests` and neighboring FreeType tests. The default Windows CTest invocation for this target failed before test execution with `0xc0000135` because its DLL directory was missing from `PATH`; prepending `build/core/libs/libs/unpatched` made four focused FreeType suites pass 3/3 each. This PR adds the same target-directory `PATH` setup to the new CTest registration. These Windows runs were on the original head, before this follow-up. This follow-up adds gray and monochrome negative-pitch comparisons and preserves output parameters on native errors. Local CMake configuration was attempted after initializing SDL2, but could not complete because other dependency submodules (FFmpeg, libusb, zstd, Opus, glslang and LibAtrac9) are unavailable or uninitialized in this worktree; the new regressions were not run locally. `python3 tools/check_conventions.py --base upstream/main --head HEAD` and `git diff --check` pass for the follow-up. Hosted product test jobs were skipped on the original head; checks for the updated head are pending. No title or GPU validation was run. Current head `b987789b00`: Linux x86-64, GCC, full CMake build (Ninja, Release) of `guest_freetype_outline_render_tests`, which passes. This host fails the startup CPU-feature gate, so the binary was run in a throwaway build copy with that check disabled; nothing of that is in the branch. As a negative control, putting the old tracked-write range back (moved back by `pitch * (rows - 1)`) makes the test fail at its tracked-write check. The public header audit and all 64 `public_headers_compile_*` batches pass. Windows was not run. ### Checklist - [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) - [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
MarcZX10 commented 2026-11-02 04:57:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:57:41Z.

Review: COMMENTED


Reviewed — reply answered, debt doc duplicates still open

The 28 Oct request about duplicate provider entries in the debt doc still applies at this head, so the branch has not changed since that comment.

What I ran

Live head 9a30149014644ad0b510c235289511272f709571 (matches batch). gh pr view --json headRefOid,state, gh api reads of issue comments, review comments and reviews, gh pr view --json statusCheckRollup, git show <head>:<path> on the debt doc, Export.cpp, OutlineRender.cpp and the test file. Nothing was built or run.

Results

Check Result Note
conventions SUCCESS hosted; does not catch the doc duplicates
windows SUCCESS hosted
linux SKIPPED hosted skip

Findings

  • oneandonlydean, 28 Oct: duplicate entries. Confirmed. docs/dev/debt/libSceFreeTypeOt.md:3 and :5 both list the identified NIDs; :4 says 139 and :6 says 129 sceFreeTypeOtUnknown_* exports. The reviewer asks to keep main's entries (:5, :6), add FT_Outline_Render to main's name list, lower main's count by one, and drop this PR's two entries (:3, :4). A grep of Export.cpp at head finds 125 unique sceFreeTypeOtUnknown_ names. I did not reconcile that with the doc's counting, so the final number is not verified.
  • Older request, outside the 28 Oct window: the test declares FT_Outline_Render_nid_postfix at GuestFreeTypeOutlineRender.cpp:18, and Api.hpp has no declaration of it. Still open at this head.

Sources

Not verified

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5732250443 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/10609#pullrequestreview-5732250443). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-02T04:57:41Z. **Review:** COMMENTED --- # Reviewed — reply answered, debt doc duplicates still open The 28 Oct request about duplicate provider entries in the debt doc still applies at this head, so the branch has not changed since that comment. ## What I ran Live head `9a30149014644ad0b510c235289511272f709571` (matches batch). `gh pr view --json headRefOid,state`, `gh api` reads of issue comments, review comments and reviews, `gh pr view --json statusCheckRollup`, `git show <head>:<path>` on the debt doc, `Export.cpp`, `OutlineRender.cpp` and the test file. Nothing was built or run. ## Results | Check | Result | Note | |---|---|---| | conventions | SUCCESS | hosted; does not catch the doc duplicates | | windows | SUCCESS | hosted | | linux | SKIPPED | hosted skip | ## Findings - `oneandonlydean`, 28 Oct: duplicate entries. Confirmed. `docs/dev/debt/libSceFreeTypeOt.md:3` and `:5` both list the identified NIDs; `:4` says 139 and `:6` says 129 `sceFreeTypeOtUnknown_*` exports. The reviewer asks to keep main's entries (`:5`, `:6`), add `FT_Outline_Render` to main's name list, lower main's count by one, and drop this PR's two entries (`:3`, `:4`). A grep of `Export.cpp` at head finds 125 unique `sceFreeTypeOtUnknown_` names. I did not reconcile that with the doc's counting, so the final number is not verified. - Older request, outside the 28 Oct window: the test declares `FT_Outline_Render_nid_postfix` at `GuestFreeTypeOutlineRender.cpp:18`, and `Api.hpp` has no declaration of it. Still open at this head. ## Sources - https://github.com/boykopovar/AnyPS5/blob/9a30149014644ad0b510c235289511272f709571/docs/dev/debt/libSceFreeTypeOt.md#L3-L6 - https://github.com/boykopovar/AnyPS5/blob/9a30149014644ad0b510c235289511272f709571/core/libs/tests/GuestFreeTypeOutlineRender.cpp#L18 ## Not verified - Negative-pitch request (older review): at head `RasterTargetSpan` starts at `buffer` and covers `|pitch| * rows` (https://github.com/boykopovar/AnyPS5/blob/9a30149014644ad0b510c235289511272f709571/core/libs/prx/libSceFreeType/src/OutlineRender.cpp#L41-L46), which matches the reviewer's ask. The test buffer placement was not checked in full. - Unique-name count versus the doc's numbers.
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!10609
No description provided.