feat(libSceFreeType): implement FT_Set_Renderer #10611
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/10611"
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 MarcZX10 on 2026-10-24T12:41:49Z.
What
Adds
FT_Set_Rendererto libSceFreeType, following the bundled FreeType 2.13.3 (ftobjs.c). The guest passes the renderer handle returned byFT_Get_Rendererand an array of 16-byte LP64FT_Parameterrecords (newGuestParameter, with a layout assertion); the adapter converts the tags to the host type, passes the data pointers through unchanged and forwards to the native call, so the argument checks, renderer-list reordering and error codes are the native ones. A tag above the hostFT_ULongrange throws, which only matters where the native type is 32 bits (Windows). Console signature and parameter layout are unverified; the debt entry says so.Commits: implementation, test, debt entry.
Tested
Linux x86-64, GCC, full CMake build (Ninja, Release).
guest_freetype_set_renderercompares the guest call with the native one for the outline and bitmap renderers: no parameters, one and two parameters with arbitrary tags, a missing parameter array, a null renderer, a null library and a renderer that belongs to another library, and checks the renderer lookup afterwards; it also passes a tag with every bit set where the hostFT_ULongis 64-bit. 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. Windows was not run.tools/check_conventions.pyandgit diff --checkpass. No title or GPU involved.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 harisibrar1 on 2026-10-24T15:46:13Z.
Review: COMMENTED
Checked against main
c9b75825f3and FreeType 2.13.3 (42608f77)src/base/ftobjs.c,src/smooth/ftgrays.c,src/raster/ftraster.c,src/sdf/ftsdf.c:Yu9oXRVmTTomatches the name, and the branch still merges cleanly into current main.FT_Set_Rendererchecks the library, the renderer,num_params && !parametersand list membership before it readsparameters, but the adapter converts every entry first (RendererSelection.cpp:18-26). So on Windows (32-bitFT_ULong),FT_Set_Renderer(lib, nullptr, 1, &p)withp.tag = 0x100000000throws, while the bundled build returnsFT_Err_Invalid_Argument; a null library or a foreign renderer behaves the same way, and it readscountguest entries in cases where native never touches them. Could the null/argument cases return the native result before the conversion loop?set_modeof every bundled renderer (smooth, raster1, sdf/bsdf) ignores tag and data, so the data pass-through is safe and the tag throw is purely conservative. The Windows throw path isn't covered by the test, since thewidecase only runs with a 64-bitFT_ULong.GuestFreeType.hpp, so the later one will need a small rebase.Reviewed with AI assistance (Claude Code); the checks above were run locally on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-02T04:57:43Z.
Review: COMMENTED
Reviewed — rebase done, three replies still open
The rebase conflicts are gone at this head, but the parameter-order fix, the unreadable-array regression and the debt wording requested on 28 and 29 Oct are not in the branch.
What I ran
Live head
a53e3648520ada06c3c71e03f242a6904b69d926(matches batch).gh pr viewfor state, mergeability andstatusCheckRollup;gh apireads of comments, review comments and reviews;git show <head>:<path>onRendererSelection.cpp,Api.hpp,GuestFreeTypeSetRenderer.cppand both debt docs;grepcounts onExport.cpp. Nothing was built or run.Results
Findings
Api.hpp:100declaresFT_Set_Renderer_nid_postfix.RendererSelection.cpp:19-26converts the parameters before any check of library, renderer or same-library membership. The tag check at:22-24throws instead of returningFT_Err_Invalid_Argument.GuestFreeTypeSetRenderer.cpp:47-48and:54passnullptrparameters. No case passes an unreadable array.libSceFreeType.md:3still says the handle "must come fromFT_Get_Renderer", with no statement that the guest cannot obtain one. NoFT_Get_Rendererdeclaration is inApi.hpp, so the reviewer's premise holds at this head.libSceFreeTypeOt.md:3-6keeps two lists with 139 and 129.Export.cpphas 123 uniquesceFreeTypeOtUnknown_names at head, matching the reviewer's count.Sources
github.com/boykopovar/AnyPS5@a53e364852/core/libs/prx/libSceFreeType/src/RendererSelection.cpp (L17-L28)github.com/boykopovar/AnyPS5@a53e364852/core/libs/tests/GuestFreeTypeSetRenderer.cpp (L47-L54)github.com/boykopovar/AnyPS5@a53e364852/docs/dev/debt/libSceFreeType.md (L3)github.com/boykopovar/AnyPS5@a53e364852/docs/dev/debt/libSceFreeTypeOt.md (L3-L6)Not verified
public_headersandguest_freetype_set_rendererruns: not run, no build.