Skip to content

feat(libSceFreeType): copy and convert guest bitmaps - #8286

Merged
adriadam10 merged 5 commits into
boykopovar:mainfrom
santhoshkumar-dev:codex/freetype-bitmap-conversion
Oct 24, 2026
Merged

adriadam10 merged 5 commits into
boykopovar:mainfrom
santhoshkumar-dev:codex/freetype-bitmap-conversion

Conversation

@santhoshkumar-dev

@santhoshkumar-dev santhoshkumar-dev commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

What

The existing libSceFreeType bridge can render a glyph bitmap but cannot initialize, retain, convert or release standalone bitmaps. Add FT_Bitmap_New, FT_Bitmap_Copy, FT_Bitmap_Convert and FT_Bitmap_Done using the bundled FreeType allocator and bitmap routines. Copies own their pixel storage; conversion preserves native row direction, alignment, pixel-mode handling and partial output state when allocation fails.

A tracked glyph-slot bitmap also updates its native record when changed or freed. The registration is removed when its guest face wrapper is destroyed, so reusing that storage cannot write through a stale native pointer. Copying a bitmap onto itself follows FreeType's no-op behavior; unsupported shared-buffer aliases throw before freeing storage.

Refresh onto fetched main e3d03fbae64e1b49e5d4e84e753ccce6edf60da5, preserving all merged FreeType features and their registrations/debt entries. The implementation and behavioral fixtures are unchanged. Rechecked newer main 74f6fa8e312462bc4b373b5ec498b2eea2b28efc before publication: no FreeType production/test/debt file changed in that interval and the branch merges cleanly. Results are pinned to the submitted head, not a claim of rebuilding newer upstream commits.

Tested

Submitted head 7f5367d4e4bb603746dbcb91eaaf4d2f490467b0.

Windows 11 x64, WinLibs GCC 15.2.0 r7, Ninja Release, bundled dependencies, BUILD_TESTING=ON, ANYPS5_ENABLE_SPIRV_TOOLS=OFF: full default build passed; 4/4 focused CTests passed, zero skips.

Local Ubuntu 24.04.1 x86-64/WSL2 (6.6.87.2), GCC 13.3.0, glibc 2.39, same build options: complete libs build plus selected executables passed; 4/4 focused CTests each passed three consecutive times. This covers the feature, existing base/charmap APIs and the 368-library packaged loader. No fresh title, console or macOS result is claimed.

The earlier Linux release and bitmap sanitizer validation by @jotitadev is retained as attributed historical evidence: #8286 (comment). The fresh Linux results below are local, without sanitizers; no fresh sanitizer claim is made.

Whitespace and conventions checks pass. The bitmap refresh retains main's outline, charmap, face-info, list and size-request source/test registrations alongside its own bitmap registration.

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 20, 2026 •

Copy link
Copy Markdown

Progress report (8eb8e39 → 7f5367d)

📈 System libraries: 47.17% (+0.02%, +4 implemented functions)

✅ 4 implemented
Library Name
libSceFreeType FT_Bitmap_Convert_nid_postfix
libSceFreeType FT_Bitmap_Copy_nid_postfix
libSceFreeType FT_Bitmap_Done_nid_postfix
libSceFreeType FT_Bitmap_New_nid_postfix

@nikowolf123

Copy link
Copy Markdown
Contributor

docs/dev/debt/libSceFreeType.md#L3 adds a new ### Bitmap handling section. CONTRIBUTING.md asks for entries "under the same ### sections as the index". The index has only four: Build, Silent stubs, Unknown function info and Functional. The Conventions check does not compare section names, so it passes. tools/debt_split.py does sort sections in index order, though, so the next split or resolve that rewrites this file will move Bitmap handling below Functional. Earlier custom sections were moved into index sections after merge (ddb1356, cb7fd81, f2558e7).

The same paragraph asks that an entry state the gap first (what differs from the console, what is unverified, what throws). In this entry the first two sentences describe the implementation, "console behavior and errors have not been measured" comes third, and what throws comes last. I would move the entry under the existing ### Unknown function info, after the FreeType 2.13.3 entry, and open with the gap, for example:

- [FT_Bitmap_New, FT_Bitmap_Copy, FT_Bitmap_Convert, FT_Bitmap_Done](../../../core/libs/prx/libSceFreeType/src/Bitmap.cpp) (libSceFreeType) - console behaviour and error codes are not measured; these follow the bundled FreeType 2.13.3. Copy and Convert throw when source and target share a non-null buffer, and Convert throws when they are the same object

@MarcZX10

Copy link
Copy Markdown
Contributor

I checked the current head and confirmed the debt entry still sits under the new ### Bitmap handling heading. tools/debt_split.py orders sections from the shared debt index, whose headings are Build, Silent stubs, Unknown function info and Functional; an extra heading can be reordered by the next split/resolve. The entry also says console behavior and errors are unmeasured only after describing the implementation. The suggested move to Unknown function info with the unverified console behavior first matches the documented debt format.

@santhoshkumar-dev
santhoshkumar-dev force-pushed the codex/freetype-bitmap-conversion branch from 5a5c21e to 211dc98 Compare October 21, 2026 12:28
@Ondra97

Ondra97 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

I opened #9550 to add FT_New_Size, FT_Activate_Size and FT_Done_Size. I declared #8286 for merge order because both patches insert declarations before GuestFace. The size objects and bitmap registration implement different functions; retain both sets of declarations when resolving that insertion.

@santhoshkumar-dev

santhoshkumar-dev commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor Author

Addressed the requested documentation placement in 6133773304. The custom Bitmap handling heading is removed; the bitmap entry is under Unknown function info, immediately after the general FreeType 2.13.3 entry. It starts with the unmeasured console behavior/error-code gap and documents unsupported alias cases. Conventions passes; this commit changes only paragraph placement.

For #9550, confirmed the merge order: bitmap registration and the additional size-object declarations are distinct and both must be retained.

@jotitadev jotitadev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

First Linux run (the PR lists Windows only). Ubuntu 26.04, glibc 2.43, x86_64 i7-8700, GCC 15.2.0, head 6133773 merged --no-commit onto origin/main 7e2ba73 (clean, the branch is ~680 commits behind).

  • Release: guest_freetype_bitmap, guest_freetype, guest_freetype_charmap and patched_libraries pass.
  • -DANYPS5_ENABLE_ASAN=ON (ASan + UBSan + LeakSanitizer): guest_freetype_bitmap passes with no report, including the forced allocation failure and the repeated convert/cleanup cases. guest_freetype passes too.
  • Not from this PR: guest_freetype_charmap fails under LeakSanitizer on main as well (16920 bytes in 95 allocations, from FT_Init_FreeType_nid_postfix and FT_New_Face_nid_postfix at GuestFreeTypeCharmap.cpp:83-85, never released). Same result with and without this PR.

No control run: the FT_Bitmap_* exports don't exist on main, so the new test doesn't link there.

Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.

@santhoshkumar-dev

Copy link
Copy Markdown
Contributor Author

Combined integration check on freshly fetched main 093149c5bd (including the latest Windows poll fix): full default Windows build passed, then 14/14 focused checks passed with no skips.

The local integration contains the current heads of #8286, #9045, #9054, #9064, #9069, #9075, #9090, #9785, #9792 and #9802. It exercises all eleven FreeType tests, both normal/NID protocol-selection runs, and loading all 367 packaged libraries. The only manual integration resolution combined both sets of CMake source/test registrations when adding the bitmap branch; no implementation changes were needed. The integration branch is local verification, and the contribution PRs remain separate.

Environment: Windows 11 x64, WinLibs GCC 15.2.0, Ninja Release, bundled dependencies, BUILD_TESTING=ON and SPIRV-Tools disabled. No console/title or Linux/macOS claim.

@santhoshkumar-dev

Copy link
Copy Markdown
Contributor Author

Thanks for the independent Linux and sanitizer validation. I added attribution and the exact tested inputs to the PR description: Release 4/4; bitmap and base FreeType pass with ASan/UBSan/LeakSanitizer. I also recorded the charmap fixture's 16,920-byte/95-allocation leak as reproduced on main, rather than claiming that fixture is sanitizer-clean. The bitmap implementation and the already-corrected debt placement are unchanged.

The #9550 merge-order agreement remains: retain both bitmap-registration and size-object declarations.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.

Pull request Conflicting files (lines on main) Same exports Same new files
PR 9453 FT_Bitmap_Convert
FT_Bitmap_Copy
FT_Bitmap_Done
FT_Bitmap_New

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 9848 core/libs/prx/libSceFreeType/CMakeLists.txt
docs/dev/debt/libSceFreeType.md

@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@santhoshkumar-dev

Copy link
Copy Markdown
Contributor Author

Refreshed to 7f5367d4e4bb603746dbcb91eaaf4d2f490467b0 on fetched main e3d03fbae64e1b49e5d4e84e753ccce6edf60da5. All merged FreeType entries and registrations are retained; the implementation/fixtures are unchanged.

Full default Windows build and 4/4 focused CTests pass. Local Ubuntu 24.04.1/WSL2, GCC 13.3/glibc 2.39: complete libs build and 4/4 focused tests, each repeated three times, including the 368-library loader, pass. The body now separates these fresh local results from the earlier independent Linux report.

Newer main 74f6fa8e31 was checked immediately before publication: its FreeType source/test/debt files are unchanged, and this branch merges cleanly. No fresh title, console or macOS result is claimed.

The earlier Linux release and bitmap sanitizer validation by @jotitadev is retained as attributed historical evidence: #8286 (comment). The fresh Linux results below are local, without sanitizers; no fresh sanitizer claim is made.

@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 23, 2026
@adriadam10
adriadam10 merged commit 2a0e9a6 into boykopovar:main Oct 24, 2026
11 of 12 checks passed
@adriadam10

Copy link
Copy Markdown
Collaborator

Checked the bitmap copy/convert/done/new paths against bundled FreeType 2.13.3 (ftbitmap.c) and the GuestBitmap layout against FT_Bitmap; the glyph-slot registration is removed in the GuestFace destructor. Debt entry is under Unknown function info. Checked on Windows (author) and Ubuntu 26.04 with ASan (@jotitadev); merged.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants