Skip to content

feat(libSceFreeType): implement FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights - #10582

Open
MarcZX10 wants to merge 11 commits into
boykopovar:mainfrom
MarcZX10:marc/freetype-lcd-filter
Open

MarcZX10 wants to merge 11 commits into
boykopovar:mainfrom
MarcZX10:marc/freetype-lcd-filter

Conversation

@MarcZX10

@MarcZX10 MarcZX10 commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights to libSceFreeType, forwarding to the bundled FreeType 2.13.3 through the guest library. The bundled build has FT_CONFIG_OPTION_SUBPIXEL_RENDERING off, so both return FT_Err_Unimplemented_Feature as in ftlcdfil.c and no filter takes effect. The five weights are read from the guest buffer through GuestArenaPrepareHostRead_nid_no_patch and copied before the call. Whether the console library enables subpixel rendering and its signatures are unverified; the debt entry says so.

Commits: for each function in turn (FT_Library_SetLcdFilter, then FT_Library_SetLcdFilterWeights), the implementation, its test and its debt entry.

Tested

Linux x86-64, GCC, full CMake build (Ninja, Release). guest_freetype_lcd_filter compares the return code of each call with the native API for every filter value including FT_LCD_FILTER_MAX, -1 and 99, for valid and null weights, and for a null library. The host CPU (Xeon E5-1620 v2) fails the startup CPU-feature gate, so I ran the test with that check disabled in a local, uncommitted edit; it exits 0. tools/check_conventions.py and git diff --check pass. No title or GPU involved.

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

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Progress report (b11c7bf → e38fcc3)

📈 System libraries: 26.71% (+0.0039%, +2 implemented, +2 declared, -2 removed functions)

✅ 2 implemented
Library Name
libSceFreeType FT_Library_SetLcdFilterWeights_nid_postfix
libSceFreeType FT_Library_SetLcdFilter_nid_postfix
🆕 2 declared as stubs
Library Name
libSceFreeTypeOt sceFreeTypeOtLibrarySetLcdFilterWeights_nid_no_patch
libSceFreeTypeOt sceFreeTypeOtLibrarySetLcdFilter_nid_no_patch
🗑️ 2 removed
Library Name
libSceFreeTypeOt sceFreeTypeOtUnknown_GiuNQjoj4fs_nid_no_patch
libSceFreeTypeOt sceFreeTypeOtUnknown_VW4GD_TaIUc_nid_no_patch

Changed libraries (implemented exports)

Library Before After Change
libSceFreeType 93/99 (93.94%) 95/101 (94.06%) +0.12%
libSceFreeTypeOt 49/148 (33.11%) 49/148 (33.11%) +0.00%

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.

Pull request Shared files not compared
PR 9410 core/libs/prx/libSceFreeType/CMakeLists.txt
core/libs/prx/libSceFreeType/include/Api.hpp
docs/dev/debt/libSceFreeType.md
PR 9419 core/libs/prx/libSceFreeType/CMakeLists.txt
core/libs/prx/libSceFreeType/include/Api.hpp
docs/dev/debt/libSceFreeType.md
PR 9848 core/libs/prx/libSceFreeType/CMakeLists.txt
docs/dev/debt/libSceFreeType.md
PR 9933 core/libs/prx/libSceFreeType/include/Api.hpp
docs/dev/debt/libSceFreeType.md
PR 10897 core/libs/prx/libSceFreeType/CMakeLists.txt
core/libs/prx/libSceFreeType/include/Api.hpp
core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeType.md
docs/dev/debt/libSceFreeTypeOt.md
PR 12004 core/libs/prx/libSceFreeType/CMakeLists.txt
core/libs/prx/libSceFreeType/include/Api.hpp
core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeType.md
PR 12370 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 12373 core/libs/prx/libSceFreeType/CMakeLists.txt
core/libs/prx/libSceFreeType/include/Api.hpp
core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeType.md
PR 12632 core/libs/prx/libSceFreeType/include/Api.hpp
core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeType.md
docs/dev/debt/libSceFreeTypeOt.md
PR 12814 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 13486 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeType.md
docs/dev/debt/libSceFreeTypeOt.md
PR 14085 docs/dev/debt/libSceFreeTypeOt.md
PR 14212 docs/dev/debt/libSceFreeType.md
docs/dev/debt/libSceFreeTypeOt.md
PR 15052 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 15053 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 15604 core/libs/prx/libSceFreeType/CMakeLists.txt
docs/dev/debt/libSceFreeType.md
PR 15687 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md
PR 15865 core/libs/prx/libSceFreeTypeOt/Export.cpp
docs/dev/debt/libSceFreeTypeOt.md

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@MarcZX10 The wrappers and the native comparison cases look right, but FT_Library_SetLcdFilter_nid_postfix and FT_Library_SetLcdFilterWeights_nid_postfix are declared only in core/libs/tests/GuestFreeTypeLcdFilter.cpp:14-15, so test_public_headers.py fails on them when merged with main. The repo rule is one declaration per export, in its library header. Please add both, with your existing signatures, to core/libs/prx/libSceFreeType/include/Api.hpp, include that header in src/LcdFilter.cpp and the test, and remove the local declarations. Then run public_headers, public_headers_compile_* and guest_freetype_lcd_filter.

@wachi35676

Copy link
Copy Markdown
Contributor

Tested head 0d93517ee9 merged onto main 14eb2cda22 on Windows 11 (WinLibs GCC 15.2.0, Release, BUILD_TESTING=ON). This adds the Windows run to the Linux one in the description.

  • The tree configures with the new test registration, and guest_freetype_lcd_filter builds and passes 3 of 3 runs on Windows.

AI-assisted: yes (Claude Code); results above were run on this machine.

@MarcZX10
MarcZX10 force-pushed the marc/freetype-lcd-filter branch from 0d93517 to ed644ce Compare October 27, 2026 00:56
@MarcZX10

Copy link
Copy Markdown
Contributor Author

Head moved to ed644ceac8 (rebased onto current main, plus new commits): the sceFreeTypeOtUnknown_* alias whose NID is a symbol this PR implements is renamed after the symbol, as the unknown-nid convention check requires (with the debt counts updated), and the exports of this PR are declared once in libSceFreeType/include/Api.hpp, with the tests including that header instead of their own extern "C" blocks, as the public header audit requires. Behaviour is unchanged. tools/check_conventions.py --base upstream/main and test_public_headers.py --audit-only pass, and the changed sources pass a syntax check; the guest tests were not rerun for this change.

@oneandonlydean

Copy link
Copy Markdown
Collaborator

@MarcZX10 The two LCD wrapper declarations now use the canonical public API, clearing that part of the earlier ask. The same head also renames two helpers in libSceFreeTypeOt/Export.cpp:109-117 to sceFreeTypeOtLibrarySetLcdFilter_nid_no_patch and sceFreeTypeOtLibrarySetLcdFilterWeights_nid_no_patch, but neither name has a public declaration. Could you declare each once with its existing int() import-resolution signature in the shared API reached by libSceFreeTypeOt.hpp and include that header in Export.cpp? Please keep their NIDs and throwing placeholder behaviour unchanged, then run public_headers, public_headers_compile_* and guest_freetype_lcd_filter on the resulting head.

@MarcZX10
MarcZX10 force-pushed the marc/freetype-lcd-filter branch from ed644ce to 315b087 Compare October 27, 2026 07:06
@MarcZX10

Copy link
Copy Markdown
Contributor Author

Declared sceFreeTypeOtLibrarySetLcdFilter_nid_no_patch and sceFreeTypeOtLibrarySetLcdFilterWeights_nid_no_patch once each in libSceFreeType/include/Api.hpp with their existing int() signature (Export.cpp already includes that header), on top of a rebase onto current main. NIDs and throwing bodies are unchanged. On 315b087056 (Linux, host CPU gate disabled in a throwaway copy): guest_freetype_lcd_filter passes, public_headers and all 64 public_headers_compile_* batches pass, conventions pass. Not run: Windows.

@babyhuey

Copy link
Copy Markdown
Contributor

Windows run of this head 315b0870568, merged onto main ea048ce2c35 (clean merge, local only), with the selection CI's skipped Windows product job uses: Windows 11, Ryzen 7 5800X, RTX 3080, WinLibs GCC 15.2, Release, BUILD_TESTING=ON. The tree was configured fresh after the merge, then select_tests.py select / ninja -f select.ninja selected / --target libs / select_tests.py ctest --parallel 4 --timeout 120.

  • Selected 1427 tests: 1418 pass, 1 fails, 8 skip. The new guest_freetype_lcd_filter passes. The one failure is guest_raise_exception timing out at 60 s, which isn't from this PR: on this machine that test went from about 18 s on main 27ad7244d22 to 51-57 s on later main (51 s on ea048ce2c35 itself in this run's baseline), so it sits at the timeout under load. I'm narrowing that down separately; this PR doesn't touch its path.

AI-assisted: yes (Claude Code)

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 27, 2026
@MarcZX10
MarcZX10 force-pushed the marc/freetype-lcd-filter branch from 315b087 to 93c0a5e Compare October 27, 2026 09:18
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 27, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Thanks, declaring both helpers once in libSceFreeType/include/Api.hpp covers the header point. The rebase moved two lines in docs/dev/debt/libSceFreeTypeOt.md: the updated FT_Outline_Get_Orientation, ... FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights entry now sits above ### Unknown function info, and the old "The 138 sceFreeTypeOtUnknown_*_nid_no_patch exports" line came back, though main replaced it with the "import-resolution helpers" entry (and there are 135 of them after this PR). Could you put the updated entry back in place of main's eight-name entry under ### Unknown function info, and drop the 138 line?

@MarcZX10

Copy link
Copy Markdown
Contributor Author

Fixed on cb9e37c (rebased onto current main): docs/dev/debt/libSceFreeTypeOt.md is back to main's layout, with the identified-NID entry under ### Unknown function info in place of main's eight-name one (now naming FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights too) and the 138 line gone. The file now differs from main only in that entry. Conventions pass. Not run again: the tests, which this commit does not touch.

@maskym

maskym commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

Windows result for head cb9e37c4e5, merged into main 2ee8e9751a (the PR's Tested section names no Windows run).

Host: Windows 11 26300, Intel i7-12700K, WinLibs GCC 15.2.0 (x86_64-ucrt-posix-seh, r6), Release, BUILD_TESTING=ON, Ninja. Build clean.

The tree also carried the open PRs #11172, #10780, #10729, #11614, #10631, #11547, #11584, #11572, all merged cleanly, so the run is a joint one; the tests of this PR are guest_freetype_lcd_filter. Together with the whole libc, CesCs, Font, FreeType, LibreSsl3 and NpUniversalDataSystem suites those tests belong to: 160/160 passed, this PR's in 0.06 s; the AudioOut suite separately 21/21. Not run on a PS5.

AI-assisted: yes (Claude Code), the runs and the numbers above are from this machine.

@MarcZX10
MarcZX10 force-pushed the marc/freetype-lcd-filter branch from cb9e37c to f1984cb Compare October 28, 2026 13:23
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 28, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@MarcZX10 the code and tests are unchanged since the last review and the earlier ask is met, but the last restack left the debt file with two overlapping entries. At f1984cb the first lines of docs/dev/debt/libSceFreeTypeOt.md are:

  1. a new entry listing FT_Outline_Get_Orientation, FT_Request_Size, FT_Sin, FT_Tan, FT_Vector_Unit, FT_New_Size, FT_Outline_Copy, FT_Outline_Decompose, FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights as identified-but-unverified NIDs;
  2. main's existing entry for the same first eight names plus the eleven FT_Stroker_* names, unchanged.

The same eight NIDs are therefore described twice, with different text, in one file. Please fold the two LCD names into main's existing entry (add "FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights" to its list) and drop the new duplicate entry, so each NID is listed once. Nothing else changes.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 28, 2026
@MarcZX10
MarcZX10 force-pushed the marc/freetype-lcd-filter branch from f1984cb to a8f5479 Compare October 28, 2026 15:40
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 28, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

@MarcZX10 the existing debt-consolidation request in #10582 (comment) still applies on a8f5479. Please fold FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights into main's current identified-NID entry and remove the separate overlapping entry, preserving the other names already on main.

One numerical update to the earlier count advice: main 52c09d5 has 124 Unknown export definitions now, and this exact branch has 122. Where this PR edits the count entry, please leave one entry matching the actual source count rather than retaining the old 129-based value. The adapter behavior and prior header/policy fixes can stay unchanged. These counts should be re-derived after any further restack.

@MarcZX10 MarcZX10 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed — debt-file requests still open at this head

The duplicate debt entry and the 129 count the reviewer asked to change are both still in the file at a8f5479.

What I ran

  • Live head a8f5479 (matches batch).
  • gh pr view 10582 (headRefOid, mergeable, statusCheckRollup); gh api GET of comments and reviews newer than 2026-10-27T10:47:16Z.
  • git show of docs/dev/debt/libSceFreeTypeOt.md at the head; git show of core/libs/prx/libSceFreeTypeOt/Export.cpp at the head, with a grep count.
  • Nothing was built or run.

Results

Check Result Note
eligibility, conventions, labels, report SUCCESS hosted
windows SUCCESS hosted
relinker, relinker-asan, register-context, write-watch SKIPPED hosted
linux SKIPPED hosted
merge state CLEAN hosted

Findings

  • oneandonlydean (2026-10-28T14:57:41Z, and 2026-10-29T05:51:29Z): fold FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights into main's identified-NID entry and remove the duplicate.
    • Not done. Debt doc line 3 is a separate entry that now lists the LCD names. Line 4 is main's entry, with the eight shared names and the FT_Stroker names, and no LCD names. The eight shared names appear twice.
    • Verified by reading.
  • Count (2026-10-29T05:51:29Z): asks that the count match the source. Line 5 still says 129. Export.cpp has 122 sceFreeTypeOtUnknown_* definitions at this head (grep count of definition lines). Not done.

Sources

  • - The FT_Outline_Get_Orientation, FT_Request_Size, FT_Sin, FT_Tan, FT_Vector_Unit, FT_New_Size, FT_Outline_Copy, FT_Outline_Decompose, FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights NIDs in [Export.cpp](../../../core/libs/prx/libSceFreeTypeOt/Export.cpp) are identified, but their provider-specific prototypes and behavior remain unverified. Their named helpers retain the explicit inventory aliases and throw; the separate libSceFreeType implementations do not supply this provider.
    - The FT_Outline_Get_Orientation, FT_Request_Size, FT_Sin, FT_Tan, FT_Vector_Unit, FT_New_Size, FT_Outline_Copy, FT_Outline_Decompose, FT_Stroker_New, FT_Stroker_Done, FT_Stroker_GetCounts, FT_Stroker_BeginSubPath, FT_Stroker_LineTo, FT_Stroker_EndSubPath, FT_Stroker_Set, FT_Stroker_Rewind, FT_Stroker_GetBorderCounts, FT_Stroker_ConicTo and FT_Stroker_CubicTo NIDs in [Export.cpp](../../../core/libs/prx/libSceFreeTypeOt/Export.cpp) are identified, but their provider-specific prototypes and behavior remain unverified. Their named helpers retain the explicit inventory aliases and throw; the separate libSceFreeType implementations do not supply this provider.
    - The 129 `sceFreeTypeOtUnknown_*_nid_no_patch` exports in [Export.cpp](../../../core/libs/prx/libSceFreeTypeOt/Export.cpp) are present in the PS5 3.20 export inventory from [PS5-3.20_Libs](https://github.com/DNNDHH/PS5-3.20_Libs). Their prototypes and behavior are unverified. Each uses the no-parameter import-resolution convention and throws through `NotImplemented_nid_no_patch`; these declarations make no ABI or behavior claim.
  • #include "prx/libSceFreeType/include/Api.hpp"
    #include <cstddef>
    #include <cstdint>
    #include "SceTypes.hpp"
    #include "prx/libSceFreeType/include/Api.hpp"
    #include "prx/libc/include/General.hpp"
    extern "C" {

Not verified

  • The count of 122 is from a grep of the file; not compared with main 52c09d5.
  • No build.

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Nov 2, 2026
…ents after them

An Unknown export whose NID is a symbol of the tree is rejected by the unknown-nid convention check, so the alias takes the symbol's name, as the already identified ones do.
…c header

The public header audit wants one declaration per export in the library header, so Api.hpp declares them with their definitions' signatures and the tests include it instead of their own extern blocks.
…ublic API

The two helpers keep their NIDs, int() signature and throwing bodies; Export.cpp includes the header that declares them.
…elpers to the identified-NID entry

The rebase had moved the identified-NID entry above the Unknown function info heading and brought back the count line main replaced with the import-resolution helpers entry.
@MarcZX10
MarcZX10 force-pushed the marc/freetype-lcd-filter branch from a8f5479 to e38fcc3 Compare November 4, 2026 11:42
@github-actions github-actions Bot added needs rebase Conflicts with main, rebase needed and removed needs rebase Conflicts with main, rebase needed labels Nov 4, 2026
@oneandonlydean

Copy link
Copy Markdown
Collaborator

Hi MarcZX10, thanks for the rebase and for the debt change. Two things are still open in docs/dev/debt/libSceFreeTypeOt.md at e38fcc3256:

  1. Line 3 is a new entry listing FT_Outline_Get_Orientation, FT_Request_Size, FT_Sin, FT_Tan, FT_Vector_Unit, FT_New_Size, FT_Outline_Copy, FT_Outline_Decompose, FT_Library_SetLcdFilter and FT_Library_SetLcdFilterWeights, and line 4 is main's entry for the same eight names plus FT_Glyph_Copy and the FT_Stroker_* names. The same NIDs are described twice. Please add the two LCD names to main's entry (line 4) and delete line 3.
  2. Line 5 says 68 sceFreeTypeOtUnknown_*_nid_no_patch exports. Export.cpp at this head has 66 distinct names (68 on main; this PR renames two), so the count should be 66.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants