feat(libSceFreeType): add partial bitmap and outline glyph ownership #9465
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/9465"
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 Felipebmaitan on 2026-10-21T22:45:58Z.
What
Add partial bitmap/outline implementations of
FT_Get_Glyph,FT_Glyph_CopyandFT_Done_Glyphto the FreeType guest bridge. Callers can retain glyphs independently of slot reloads and face destruction, create independent copies, and release each glyph separately.The adapter exposes LP64 root, bitmap and outline records with layout assertions, copies guest-visible fields and preserves native bitmap ownership transfer, validation order and output-pointer state on errors. Outline coordinates remain 64-bit even where native
FT_Posis 32-bit.Names and NIDs follow the PS5 3.20 export inventory:
FT_Get_Glyph/eMKHL+Cj50k,FT_Glyph_Copy/Dr3F3qrSQ2c, andFT_Done_Glyph/RdrrejUMiJ0. The original contract reference is FreeType 2.13.3 ftglyph.c. Console ABI/version equivalence remains unverified and recorded in debt. SVG/custom classes, foreign handles and unsupported ownership changes throw. Release glyphs before their library. The exports remain partial implementations.Merged main
4ac683fe026c3368e508ace9745d3017e12a1207into live head66a9f90ab9059de487e9a43cb9625428fa891344for the November 1 maintainer request, preserving the existing branch history. The only conflict wasdocs/dev/debt/libSceFreeTypeOt.md: retained main's independent notes and the glyph-copy alias note, and recounted 72 unknown helpers from the mergedExport.cppdefinitions. ProductionGlyph.cppandGuestFreeTypeGlyph.cppare byte-identical to the incoming head, including checked signed/unsigned conversions, full-width outline coordinates, ownership/lifetime contracts and the corrected comparison against native FreeType 2.15.0 bitmap aliasing. No unrelated PR branch was changed.Both #9398 and #9399 are merged and included through main; no outstanding predecessor reservation remains. #9588 remains downstream of this ownership PR.
Tested
Fresh integration verification on macOS arm64, Apple Clang 21.0.0, targeting x86-64, 2026-11-01; submitted merge head
9434fea162948340aa9d1c58e5ffd7713b82a4b8:37515cf56ba3349656049edbed89ffc6f6466f2d(2.15.0) from source with CMake/Ninja, Release, two compiler jobs, matching the project's disabled optional FreeType dependencies.-std=c++20 -Wall -Wextra -Werror -Wno-return-type-c-linkage -fsyntax-onlychecks pass for 22 translation units: every FreeType bridge source, both provider export files and the corrected glyph regression. The Clang suppression covers existing C-linkage declarations inGeneral.hpp.Glyph.cppalso compiles to an optimized x86-64 Mach-O object. These checks do not link or execute the guest runtime.test_public_headers.pywith two workers. This is not the complete header compilation suite.origin/mainand the immutable merged main snapshot; PR-diff whitespace checks pass. Glyph production and regression files are byte-identical to incoming66a9f90ab9; the merge retains the complete history and all independent main debt entries.69bfe767857056b99c2369fcb015498860332213; its intervening changes touch none of the FreeType/OpenType source or debt files. Fresh compilation covers the integrated4ac683fe026snapshot.python3 tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch fix/pr-9465-glyph-main-nov01 --jobs 2scanned the exact submitted merge head against main4ac683fe026, using isolated Git metadata. It fetched 1,849 candidate heads and probed 1,848 non-ancestor PRs. Automatic comparison exited 2 because four PRs conflict with main. Manually inspected all reported shared-file patches for #10606 (library references), #12004/#12373 (allocation/reallocation) and #14212 (debt formatting/count removal): they do not add these glyph ownership functions. Confirmed overlaps are downstream #9588 and shared OpenType debt insertions. This is not a claim that every other PR merges cleanly; the complete report is in the refresh reply.Historical Windows verification (preserved from the October 30 refresh response):
Windows x86-64, WinLibs MinGW-w64 GCC 15.2.0, Release,
BUILD_TESTING=ON, source-built pinned dependencies, on 2026-10-29. Integrated main1189ec3003672bb364dd9f3119ead7b3976e3c83; tested submitted head66a9f90ab9059de487e9a43cb9625428fa891344. Current FreeType submodule37515cf56ba3349656049edbed89ffc6f6466f2dreports 2.15.0.libsbuild.ctest --test-dir build -R <selected names> -V --timeout 30 --no-tests=error.ctest --test-dir build -R '^public_headers_compile_(13|14|17|18|19|26)$' -FA public_headers_manifest -j 2 -V --no-tests=error: 6/6 batches passed, 18.21 s. These cover every FreeType/OpenType public header and the combined library-umbrella compilation unit; this is not all 64 compilation batches.python tools/check_conventions.py --base origin/main,git diff origin/main...HEAD --checkandgit diff --checkpass. All CMake/API lines from the integrated main are retained; productionGlyph.cppis byte-identical to incoming7f3a3a3f39.python tools/pr_overlap.py --repo boykopovar/AnyPS5 --branch review/pr-9465-refresh-20261029 --jobs 2completed for code/test/header-identical head6a00e9b9961cea75092e34f76c62ae6a1c07cc55using isolated Git metadata inside ignored artifacts after a shared-ref fetch race. All 1,435 candidate heads were probed. The submitted head differs from that scan only in documentation. Downstream #9588 carries these glyph exports/files by design. Other shared-file/debt conflicts and uncomparable PRs remain in the report; this is not a claim of no overlap. No unmerged implementation was imported or other PR branch edited. The full report is included in the refresh response.08a10d225306ad102b57408e2ef7566bcfb829b2was clean. Runtime evidence covers the integrated1189ec30036snapshot, not later main changes.Not run on this submitted head: Linux/macOS execution, PS5 hardware, a title, the complete CTest suite, full library packaging/loader tests, or all public-header compilation batches. Older Windows/Linux/Clang reports belong to their explicitly stated historical heads in the review history.
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-10-21T22:49:18Z.
Code review location:
core/libs/prx/libSceFreeType/src/Glyph.cpp; line 67This source currently fails a direct Linux syntax compile against FreeType headers. I ran
c++ -std=c++20 -fsyntax-only -Icore/libs -Icore/libs/prx/libc/include -I/usr/include/freetype2 core/libs/prx/libSceFreeType/src/Glyph.cpp(host FreeType 2.13.18). It reports an invalid list assignment here and atGlyph::Publishline 36:FT_Outline::n_contours/n_pointsare signedshort, while the guest fields areuint16_t. It also rejects the pointer comparisons at line 189 (char*vsunsigned char*,short*vsuint16_t*). The pinned FreeType 2.13.3FT_Outlineuses the same signed fields/pointers. Please add explicit checked conversions and compatible pointer comparisons, then run this focused compile (or the real target) so the new source is compiled.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T22:49:20Z.
Review: CHANGES_REQUESTED
Requesting one blocking fix:
Glyph.cppdoes not compile because itsFT_Outlineaggregate conversions and pointer comparisons conflict with FreeType field types. I left an inline comment with the exact direct-compile command and diagnostics. The PR’s hosted eligibility, intake, conventions, labels and report checks are green, but all build jobs are skipped, so they did not exercise the new source.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-21T22:56:52Z.
Review: CHANGES_REQUESTED
I recompiled the new head
65dd86603589ba446a3703487bc2ef2a3b50e8d6; the reported compile blockers remain. With the same focused command against FreeType 2.13.18 headers,Glyph.cppstill fails at theGuestOutlineaggregate assignment inGlyph::Publish, theFT_Outlineaggregate assignment inOutline, and comparisons betweenunsigned char*/char*anduint16_t*/signedshort*inFT_Done_Glyph. Please use explicit, checked field conversions and compatible pointer handling, then rerun the syntax compile. Hosted eligibility and conventions pass on the new head; all build jobs are skipped, so CI has not exercised this source.Imported from boykopovar/AnyPS5. Originally posted by Felipebmaitan on 2026-10-21T23:03:18Z.
Code review location:
core/libs/prx/libSceFreeType/src/Glyph.cpp; line 67Fixed in 9d667e1c9.
The adapter now checks outline counts before converting in either direction, explicitly adapts the signed/unsigned tag and contour array views, and compares their addresses through
const void*. Unrepresentable counts throw rather than wrap, with the limitation recorded in debt. Added reference tests for maximum representable point counts and preservation of high-bit tag/contour data, plus rejection tests for counts beyond signed host limits.I reproduced the old head's errors using installed FreeType 2.13.2 headers. Our pinned 2.13.3 checkout uses unsigned outline fields, which explains why the earlier bundled build did not catch this header variant.
Validation on Linux x86-64/GCC 13.3:
-Wall -Wextra -Werroragainst installed signed-field headers and pinned unsigned-field headers.libsbuild passes, and all 10 focused font/FreeType/loader runtime tests pass.Windows and PS5 remain untested. The PR description has the updated validation details.
Imported from boykopovar/AnyPS5. Originally posted by Felipebmaitan on 2026-10-21T23:52:57Z.
Code review location:
core/libs/prx/libSceFreeType/src/Glyph.cpp; line 67Independently rechecked the current head
9d667e1c929d5415a1a6d8d434a867c2c5ab8fcbon Windows x86-64 with the supported WinLibs GCC 15.2.0 toolchain.The previous head
65dd866reproduces all reported aggregate-assignment and pointer-comparison failures against the official FreeType 2.13.2 signed-field headers. On the current head, both new C++ files pass-std=c++20 -Wall -Wextra -Werror -fsyntax-onlyagainst those headers and against the pinned bundled headers.A fresh full-project Release configuration compiled and linked the actual FreeType bridge, its libc/libkernel dependencies, the font libraries and the focused test executables. All 9 font/FreeType runtime tests pass, including
guest_freetype_glyph, with no skips (0.74 s total). This was a focused target build; the full Windowslibstarget and patched-library loader were not run. Conventions andgit diff --checkalso pass.No further source changes were needed. The PR description now includes this Windows verification. Resolving this compile-error thread as addressed by the existing fix; hosted full builds remain skipped and the declared #9399 merge ordering still applies.
Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-22T00:06:57Z.
I am preparing a separate
FT_Outline_Copyimplementation. It overlaps this PR only at thelibSceFreeType.mddebt insertion; no exports or tests overlap. I will list #9465 as a merge-order dependency and rebase my debt entry after this PR merges. No changes to your branch are needed.Imported from boykopovar/AnyPS5. Originally posted by Ondra97 on 2026-10-22T03:31:28Z.
I opened #9588 for FT_Glyph_Get_CBox. I declared #9465 as an implementation dependency and reuse its existing registered glyph ownership. Merge this ownership PR first; the new query reads the guest geometry while preserving the existing copy/destruction checks.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-22T04:33:59Z.
Review: CHANGES_REQUESTED
The current head appears to address the earlier FreeType type-conversion compile findings, and the PR reports a focused 10/10 Linux test run including comparison against native FreeType, with ownership/error cases and boundary coordinates. The branch is still based on
a6dcea927, 47 upstream commits behind currentmain(110a18ba01), and the test report explicitly uses that old base. Please rebase/update and rerun the focused glyph and related FreeType tests plus conventions and overlap checks on current main; preserve the agreed #9399-first CMake registration order. The current hosted build matrix skips Linux and Windows, so it has not independently compiled this source. I did not rerun the author’s reported suite locally.