build(videoout): link one SDL copy on macOS #11119

Merged
Betr0x merged 2 commits from upstream-pr/11119 into main 2026-11-08 14:47:50 +00:00
Betr0x commented 2026-10-25 18:39:32 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by Betr0x on 2026-10-25T18:39:32Z.


What

Follow-up to #11049, which @imellag asked me to open there. On macOS the Objective-C runtime registers SDL's classes from every copy in the process. libSceVideoOut linked its own SDL2-static next to libSceAgcDriver's, so every relinked title printed 14 Class SDL_... is implemented in both .../libSceAgcDriver.prx and .../libSceVideoOut.prx warnings, which the runtime says "may cause spurious casting failures and mysterious crashes".

On Apple, libSceVideoOut now takes SDL from libSceAgcDriver, which it already links, the same way #11049 does for libSceAudioIn and libSceAudioOut. The test executables that link both libSceVideoOut and their own SDL2-static (video_out_mouse_tests, pad_sdl_tests, video_out_hdr_probe_tests, video_out_telemetry_tests) follow: without that, pad_sdl aborts, because it attaches its virtual joysticks in its own SDL copy while VideoOut asks libSceAgcDriver's. pad_sdl_tests gets ${ANYPS5_SDL2_INCLUDE_DIR}, which it used to receive through SDL2-static.

On Linux and Windows videoOutSdl is SDL2-static, so every link line is the same as before.

Tested

Apple M4 (10-core GPU), macOS 27.0.1, Apple clang 21, x86-64 Release under Rosetta 2 (-DCMAKE_OSX_ARCHITECTURES=x86_64, Ninja, BUILD_TESTING=ON), MoltenVK 1.4.2 from the LunarG SDK 1.4.363.0. main does not build the libraries on macOS by itself, so the tree is main 3a2c51afd merged with mugurc's ci/macos-series-2 (which carries #11049's change as 63db337cd8), #10885 and #10540. Both states below are the same tree, with core/libs/prx/libSceVideoOut/CMakeLists.txt as on main and as in this PR.

main this PR
libSceVideoOut.prx 1,748,816 bytes, 837 SDL symbols defined 319,352 bytes, 0 defined, 55 imported from libSceAgcDriver
Syobon Action (PPSA47402, catalog 01.001.000), 30 s with pad input 14 duplicate class warnings 0
DriftCheck (PPSA98766, catalog 01.000.000), 20 s with pad input 14 0
video_out_mouse_tests passes, 14 warnings passes, 0
pad_sdl, video_out_telemetry*, video_out_hdr_probe output 56 warnings 0
ctest -R "video_out|audio|pad|mouse|keyboard" 97/97 pass, 25 skipped 97/97 pass, 25 skipped

Both titles were relinked with --macos --to-rosetta and driven through APS5_PAD_INPUT_FILE: Syobon Action reaches level 1 and moves, DriftCheck shows both sticks, L1+R1 and Triangle, in both states.

Validation, as CONTRIBUTING asks for VideoOut changes (VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, ANYPS5_REQUIRE_VULKAN=1, ANYPS5_NO_SHADER_CACHE=1):

  • ctest -R "video_out|pad_sdl" -V: 32/32 pass in both states, no was not found but was requested by env var VK_INSTANCE_LAYERS, no VUID-. This says little on macOS: every VideoOut test that creates a Vulkan device skips there (Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen)), and with VK_LOADER_DEBUG=layer none of the 32 inserts the layer.
  • So the two titles were run under the same variables instead. With VK_LOADER_DEBUG=layer the loader inserts VK_LAYER_KHRONOS_validation in every run; both titles log no VUID- on main and with this PR, and dump the same number of frames (8 each).

Linux and Windows: not built here; on both videoOutSdl expands to SDL2-static.

python3 tools/check_conventions.py --base origin/main passes. python3 tools/pr_overlap.py could not compare core/libs/prx/libSceVideoOut/CMakeLists.txt with #674, #5021, #7201 and #8927, which conflict with main. Of those, #674 changes the same target_link_libraries(libSceVideoOut ...) line, for its input editor; none of them changes how VideoOut gets SDL on macOS. The two were combined by hand: no merge order is needed, and whichever lands second puts #674's anyps5_input_editor anyps5_input in front of the current line and keeps ${videoOutSdl} in place of SDL2-static (details in the review reply; #674 also needs a rebase onto current main for other files).

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: #11049 (no order needed with #674, combined by hand, see Tested)
  • Fixes: none
  • Unblocks: none
  • GPUs tested: Apple M4 (10-core GPU), MoltenVK 1.4.2 (LunarG SDK 1.4.363.0), macOS 27.0.1, x86-64 under Rosetta 2
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5007557079 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11119). Originally posted by [Betr0x](https://github.com/Betr0x) on 2026-10-25T18:39:32Z. --- ### What Follow-up to #11049, which @imellag asked me to open there. On macOS the Objective-C runtime registers SDL's classes from every copy in the process. `libSceVideoOut` linked its own `SDL2-static` next to `libSceAgcDriver`'s, so every relinked title printed 14 `Class SDL_... is implemented in both .../libSceAgcDriver.prx and .../libSceVideoOut.prx` warnings, which the runtime says "may cause spurious casting failures and mysterious crashes". On Apple, `libSceVideoOut` now takes SDL from `libSceAgcDriver`, which it already links, the same way #11049 does for `libSceAudioIn` and `libSceAudioOut`. The test executables that link both `libSceVideoOut` and their own `SDL2-static` (`video_out_mouse_tests`, `pad_sdl_tests`, `video_out_hdr_probe_tests`, `video_out_telemetry_tests`) follow: without that, `pad_sdl` aborts, because it attaches its virtual joysticks in its own SDL copy while VideoOut asks `libSceAgcDriver`'s. `pad_sdl_tests` gets `${ANYPS5_SDL2_INCLUDE_DIR}`, which it used to receive through `SDL2-static`. On Linux and Windows `videoOutSdl` is `SDL2-static`, so every link line is the same as before. ### Tested Apple M4 (10-core GPU), macOS 27.0.1, Apple clang 21, x86-64 Release under Rosetta 2 (`-DCMAKE_OSX_ARCHITECTURES=x86_64`, Ninja, `BUILD_TESTING=ON`), MoltenVK 1.4.2 from the LunarG SDK 1.4.363.0. `main` does not build the libraries on macOS by itself, so the tree is `main` `3a2c51afd` merged with mugurc's `ci/macos-series-2` (which carries #11049's change as `63db337cd8`), #10885 and #10540. Both states below are the same tree, with `core/libs/prx/libSceVideoOut/CMakeLists.txt` as on `main` and as in this PR. | | `main` | this PR | |---|---|---| | `libSceVideoOut.prx` | 1,748,816 bytes, 837 SDL symbols defined | 319,352 bytes, 0 defined, 55 imported from `libSceAgcDriver` | | Syobon Action (PPSA47402, catalog 01.001.000), 30 s with pad input | 14 duplicate class warnings | 0 | | DriftCheck (PPSA98766, catalog 01.000.000), 20 s with pad input | 14 | 0 | | `video_out_mouse_tests` | passes, 14 warnings | passes, 0 | | `pad_sdl`, `video_out_telemetry*`, `video_out_hdr_probe` output | 56 warnings | 0 | | `ctest -R "video_out\|audio\|pad\|mouse\|keyboard"` | 97/97 pass, 25 skipped | 97/97 pass, 25 skipped | Both titles were relinked with `--macos --to-rosetta` and driven through `APS5_PAD_INPUT_FILE`: Syobon Action reaches level 1 and moves, DriftCheck shows both sticks, L1+R1 and Triangle, in both states. Validation, as CONTRIBUTING asks for VideoOut changes (`VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `ANYPS5_REQUIRE_VULKAN=1`, `ANYPS5_NO_SHADER_CACHE=1`): - `ctest -R "video_out|pad_sdl" -V`: 32/32 pass in both states, no `was not found but was requested by env var VK_INSTANCE_LAYERS`, no `VUID-`. This says little on macOS: every VideoOut test that creates a Vulkan device skips there (`Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen)`), and with `VK_LOADER_DEBUG=layer` none of the 32 inserts the layer. - So the two titles were run under the same variables instead. With `VK_LOADER_DEBUG=layer` the loader inserts `VK_LAYER_KHRONOS_validation` in every run; both titles log no `VUID-` on `main` and with this PR, and dump the same number of frames (8 each). Linux and Windows: not built here; on both `videoOutSdl` expands to `SDL2-static`. `python3 tools/check_conventions.py --base origin/main` passes. `python3 tools/pr_overlap.py` could not compare `core/libs/prx/libSceVideoOut/CMakeLists.txt` with #674, #5021, #7201 and #8927, which conflict with `main`. Of those, #674 changes the same `target_link_libraries(libSceVideoOut ...)` line, for its input editor; none of them changes how VideoOut gets SDL on macOS. The two were combined by hand: no merge order is needed, and whichever lands second puts #674's `anyps5_input_editor anyps5_input` in front of the current line and keeps `${videoOutSdl}` in place of `SDL2-static` (details in the review reply; #674 also needs a rebase onto current `main` for other files). ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [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: #11049 (no order needed with #674, combined by hand, see Tested) - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: Apple M4 (10-core GPU), MoltenVK 1.4.2 (LunarG SDK 1.4.363.0), macOS 27.0.1, x86-64 under Rosetta 2 - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-25 18:41:57 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:41:57Z.

Review: CHANGES_REQUESTED


The macOS SDL de-duplication approach and the reported measurements are clear. The repository overlap check could not compare this file against #674, and the PR description confirms that #674 changes the same target_link_libraries(libSceVideoOut ...) line. The current checklist declares only #11049 as a dependency. Please coordinate the merge order with #674’s author and add a Depends on: #674 entry if the line-level conflict requires an order; otherwise record that both changes were manually combined cleanly. This is the remaining workflow blocker I found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644692249 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11119#pullrequestreview-5644692249). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T18:41:57Z. **Review:** CHANGES_REQUESTED --- The macOS SDL de-duplication approach and the reported measurements are clear. The repository overlap check could not compare this file against #674, and the PR description confirms that #674 changes the same `target_link_libraries(libSceVideoOut ...)` line. The current checklist declares only #11049 as a dependency. Please coordinate the merge order with #674’s author and add a `Depends on: #674` entry if the line-level conflict requires an order; otherwise record that both changes were manually combined cleanly. This is the remaining workflow blocker I found.
MarcZX10 commented 2026-10-25 18:50:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-25T18:50:53Z.

Review: APPROVED


The author has now recorded a concrete manual resolution for the shared link line and notified #674’s author. I checked the current diff: Apple links the VideoOut and affected test targets through libSceAgcDriver, while Linux and Windows retain SDL2-static; the input libraries from #674 can be retained alongside this ${videoOutSdl} selection as shown in the follow-up. The reported Apple test/title runs and validation results cover the changed platform path. The earlier overlap coordination point is addressed; the remaining large rebase conflicts on #674 are separate from this PR.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5644720640 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11119#pullrequestreview-5644720640). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-25T18:50:53Z. **Review:** APPROVED --- The author has now recorded a concrete manual resolution for the shared link line and notified #674’s author. I checked the current diff: Apple links the VideoOut and affected test targets through `libSceAgcDriver`, while Linux and Windows retain `SDL2-static`; the input libraries from #674 can be retained alongside this `${videoOutSdl}` selection as shown in the follow-up. The reported Apple test/title runs and validation results cover the changed platform path. The earlier overlap coordination point is addressed; the remaining large rebase conflicts on #674 are separate from this PR.
THEMANnt commented 2026-10-26 19:17:53 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-26T19:17:53Z.

Review: COMMENTED


Reviewed 572fa398d8e3a7a542b2ad6c02036db8b118515d. Pending review.

The VideoOut link selection is checked; native Apple verification and upstream Build authorization remain pending.

Validation: Actual submitted CMake selects libSceAgcDriver for the changed Darwin library/test links and SDL2-static on Linux/Windows; the extra pad_sdl include directory is retained. These branch checks are not macOS links or controller execution.

Scope / next step: The author reports combined-series macOS testing, which I have not independently rerun. Complete the authorized hosted Build and retain native Apple SDL/VideoOut evidence before final approval.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5657695373 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11119#pullrequestreview-5657695373). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-26T19:17:53Z. **Review:** COMMENTED --- Reviewed `572fa398d8e3a7a542b2ad6c02036db8b118515d`. Pending review. The VideoOut link selection is checked; native Apple verification and upstream Build authorization remain pending. **Validation:** Actual submitted CMake selects libSceAgcDriver for the changed Darwin library/test links and SDL2-static on Linux/Windows; the extra pad_sdl include directory is retained. These branch checks are not macOS links or controller execution. **Scope / next step:** The author reports combined-series macOS testing, which I have not independently rerun. Complete the authorized hosted Build and retain native Apple SDL/VideoOut evidence before final approval.
jotitadev commented 2026-10-27 07:06:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-27T07:06:10Z.

Review: COMMENTED


Ran head 572fa398d on a second Apple Silicon machine, both on its own and together with #11049.

Machine: Apple M2 Max (32 GB), macOS 27.2 (26B5112a), Apple clang 21.0.0, x86_64 Release under Rosetta 2 (-DCMAKE_OSX_ARCHITECTURES=x86_64, Ninja, BUILD_TESTING=ON, Python 3.9 from Xcode).
Base: main b986c11a34 does not build the libraries on macOS by itself, so the tree is that main plus the open macOS build PRs (#10366, #7631, #10659, #10660, #11249, #11358, #10669, #10552, #7804, #10676, #11447, #11437) and #11554, plus #11705 (applied locally). Only this PR is toggled, with git merge --no-commit on top.

Copies of SDL in the built .prx files: Objective-C SDL* classes, plus SDL_ symbols defined and imported. The warnings come from a small x86_64 program that dlopens libSceAgcDriver, libSceVideoOut, libSceAudioIn and libSceAudioOut and counts is implemented in both:

base this PR #11049 this PR + #11049
libSceVideoOut.prx 13 classes, 837 defined, 1,741,768 B 0 defined, 55 imported, 312,304 B unchanged 0 defined, 55 imported
libSceAudioIn / libSceAudioOut 837 defined each unchanged 0 defined, 7 / 14 imported 0 defined, 7 / 14 imported
duplicate class warnings, all four loaded 42 28 14 0
video_out_mouse + pad_sdl output (ctest -V) 28 warnings 0 not run not run
  • pad_sdl and video_out_mouse pass 3/3 with this PR.
  • ctest -R "audio|pad|mouse|keyboard|sdl" passes 71/71, alone and together with #11049. I left out the video_out flip, HDR-probe and telemetry tests, which open windows.
  • #11049 alone passes ctest -R audio 51/51, 3/3.
  • All three states build without new failures.

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

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5663372081 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11119#pullrequestreview-5663372081). Originally posted by [jotitadev](https://github.com/jotitadev) on 2026-10-27T07:06:10Z. **Review:** COMMENTED --- Ran head `572fa398d` on a second Apple Silicon machine, both on its own and together with #11049. **Machine:** Apple M2 Max (32 GB), macOS 27.2 (26B5112a), Apple clang 21.0.0, x86_64 Release under Rosetta 2 (`-DCMAKE_OSX_ARCHITECTURES=x86_64`, Ninja, `BUILD_TESTING=ON`, Python 3.9 from Xcode). **Base:** `main` `b986c11a34` does not build the libraries on macOS by itself, so the tree is that `main` plus the open macOS build PRs (#10366, #7631, #10659, #10660, #11249, #11358, #10669, #10552, #7804, #10676, #11447, #11437) and #11554, plus #11705 (applied locally). Only this PR is toggled, with `git merge --no-commit` on top. Copies of SDL in the built `.prx` files: Objective-C `SDL*` classes, plus `SDL_` symbols defined and imported. The warnings come from a small x86_64 program that `dlopen`s `libSceAgcDriver`, `libSceVideoOut`, `libSceAudioIn` and `libSceAudioOut` and counts `is implemented in both`: | | base | this PR | #11049 | this PR + #11049 | |---|---|---|---|---| | `libSceVideoOut.prx` | 13 classes, 837 defined, 1,741,768 B | 0 defined, 55 imported, 312,304 B | unchanged | 0 defined, 55 imported | | `libSceAudioIn` / `libSceAudioOut` | 837 defined each | unchanged | 0 defined, 7 / 14 imported | 0 defined, 7 / 14 imported | | duplicate class warnings, all four loaded | 42 | 28 | 14 | **0** | | `video_out_mouse` + `pad_sdl` output (`ctest -V`) | 28 warnings | 0 | not run | not run | - `pad_sdl` and `video_out_mouse` pass 3/3 with this PR. - `ctest -R "audio|pad|mouse|keyboard|sdl"` passes 71/71, alone and together with #11049. I left out the video_out flip, HDR-probe and telemetry tests, which open windows. - #11049 alone passes `ctest -R audio` 51/51, 3/3. - All three states build without new failures. Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
THEMANnt commented 2026-10-28 04:24:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by THEMANnt on 2026-10-28T04:24:30Z.

Review: COMMENTED


Reviewed f92e5b7c3ed4dfdc949da3fcb29709ef20eca35f — comment; validation/readiness remains incomplete.

The updated CMake retains the intended Apple SDL selection, including the newly affected HDR-probe and telemetry links. Native Apple verification remains outside my available environment.

Executed the submitted CMake conditionals with target-command recording for Darwin, Linux and Windows: all five affected targets use libSceAgcDriver for the selected Apple SDL dependency and retain SDL2-static elsewhere. The corresponding author-base branches were checked too. This evaluates real CMake control flow, but does not link Mach-O libraries, load Objective-C classes or run pad/VideoOut tests. The author’s combined-series macOS and validation-layer results remain author evidence; I did not independently rerun them. No new production defect found.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5677771861 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11119#pullrequestreview-5677771861). Originally posted by [THEMANnt](https://github.com/THEMANnt) on 2026-10-28T04:24:30Z. **Review:** COMMENTED --- Reviewed `f92e5b7c3ed4dfdc949da3fcb29709ef20eca35f` — comment; validation/readiness remains incomplete. The updated CMake retains the intended Apple SDL selection, including the newly affected HDR-probe and telemetry links. Native Apple verification remains outside my available environment. Executed the submitted CMake conditionals with target-command recording for Darwin, Linux and Windows: all five affected targets use libSceAgcDriver for the selected Apple SDL dependency and retain SDL2-static elsewhere. The corresponding author-base branches were checked too. This evaluates real CMake control flow, but does not link Mach-O libraries, load Objective-C classes or run pad/VideoOut tests. The author’s combined-series macOS and validation-layer results remain author evidence; I did not independently rerun them. No new production defect found.
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!11119
No description provided.