fix(agc): parse FSR sharpness on older macOS runtimes #27843

Open
RavenCurseBurg wants to merge 4 commits from upstream-pr/27843 into main
RavenCurseBurg commented 2026-11-27 15:18:10 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by RavenCurseBurg on 2026-11-27T15:18:10Z.


What

Targeting macOS 15 prevents the AGC driver from compiling because Apple's floating-point std::from_chars is available from macOS 26. For older deployment targets, parse ANYPS5_FSR_SHARPNESS with Darwin's C-locale decimal conversion. Preserve the caller's floating-point environment and errno. The configuration accepts finite decimal values in the range 0 to 2, including representable subnormal values. The availability check keeps the existing conversion on macOS 26 and the other hosts.

Extend the existing presentation test with decimal exponent, subnormal, underflow, hexadecimal, leading plus, locale separator, and rounding-mode cases. This addresses the driver compilation failure observed while testing #24341.

Tested

  • On Intel macOS 15, Xcode 16.4, 26.2 and 26.3 each rejected the parent header and compiled the candidate for both x86-64 and arm64. In native x86-64 execution each toolchain matched the expected float bits or rejection for 3,048 strings, covering four rounding modes and two numeric locales. CMake also compiled the real driver and presentation test translation units targeting macOS 15 with #26739's libc++abi declaration. macOS 15 results
  • On Intel macOS 26.6.1, native-target old and new binaries matched in all 24,384 comparisons. A second binary targeting macOS 15 matched the back-deployment reference in all 24,384 comparisons on this host. macOS 26 results
  • On Windows 11 with MinGW GCC 15.2, agc_driver_presentation_pass and agc_driver_presentation_fsr each passed three times on RTX 4060 and Intel UHD 770 on both parent and candidate. The Vulkan validation layer reported no VUID or synchronization hazards.
  • Project conventions passed. The branch overlap scan compared 2,701 open PRs. Five stale branches conflicted with the scan base. Their shared presentation test changes exercise GPU descriptor heaps, image tables, and samplers. I inspected the patches for #7642, #9508, #10193, #13928, and #13929.

I merged upstream 363e0bed4def into the submitted branch and checked the resulting tree. The project’s code and PR conventions passed.

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: NVIDIA GeForce RTX 4060 and Intel UHD Graphics 770
  • AI-assisted: yes (Codex + GPT-6.2 Astra, xhigh)

Summary by CodeRabbit

  • Bug Fixes
    • Improved sharpness value handling on supported macOS versions, including decimal exponent notation and very small representable values.
    • Inputs with malformed numbers, values too small to represent, or values outside the supported 0.0–2.0 range are rejected.
    • Sharpness values are interpreted consistently using decimal notation, and parsing does not change the application’s rounding behavior.
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5529003159 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27843). Originally posted by [RavenCurseBurg](https://github.com/RavenCurseBurg) on 2026-11-27T15:18:10Z. --- ### What Targeting macOS 15 prevents the AGC driver from compiling because Apple's floating-point `std::from_chars` is available from macOS 26. For older deployment targets, parse `ANYPS5_FSR_SHARPNESS` with Darwin's C-locale decimal conversion. Preserve the caller's floating-point environment and `errno`. The configuration accepts finite decimal values in the range 0 to 2, including representable subnormal values. The availability check keeps the existing conversion on macOS 26 and the other hosts. Extend the existing presentation test with decimal exponent, subnormal, underflow, hexadecimal, leading plus, locale separator, and rounding-mode cases. This addresses the driver compilation failure observed while testing #24341. ### Tested - On Intel macOS 15, Xcode 16.4, 26.2 and 26.3 each rejected the parent header and compiled the candidate for both x86-64 and arm64. In native x86-64 execution each toolchain matched the expected float bits or rejection for 3,048 strings, covering four rounding modes and two numeric locales. CMake also compiled the real driver and presentation test translation units targeting macOS 15 with #26739's libc++abi declaration. [macOS 15 results](https://github.com/RavenCurseBurg/AnyPS5/actions/runs/45706850236/job/139530910821) - On Intel macOS 26.6.1, native-target old and new binaries matched in all 24,384 comparisons. A second binary targeting macOS 15 matched the back-deployment reference in all 24,384 comparisons on this host. [macOS 26 results](https://github.com/RavenCurseBurg/AnyPS5/actions/runs/45706850236/job/139530910562) - On Windows 11 with MinGW GCC 15.2, `agc_driver_presentation_pass` and `agc_driver_presentation_fsr` each passed three times on RTX 4060 and Intel UHD 770 on both parent and candidate. The Vulkan validation layer reported no VUID or synchronization hazards. - Project conventions passed. The branch overlap scan compared 2,701 open PRs. Five stale branches conflicted with the scan base. Their shared presentation test changes exercise GPU descriptor heaps, image tables, and samplers. I inspected the patches for #7642, #9508, #10193, #13928, and #13929. I merged upstream `363e0bed4def` into the submitted branch and checked the resulting tree. The project’s code and PR conventions passed. ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: NVIDIA GeForce RTX 4060 and Intel UHD Graphics 770 - [x] AI-assisted: yes (Codex + GPT-6.2 Astra, xhigh) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Bug Fixes** * Improved sharpness value handling on supported macOS versions, including decimal exponent notation and very small representable values. * Inputs with malformed numbers, values too small to represent, or values outside the supported 0.0–2.0 range are rejected. * Sharpness values are interpreted consistently using decimal notation, and parsing does not change the application’s rounding behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
MarcZX10 commented 2026-11-27 15:29:28 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T15:29:28Z.

Review: CHANGES_REQUESTED


Reviewed — comments

Changes are required before merge: resolve whether the older macOS parser preserves the floating-point environment when its setup calls fail.

What I ran

Inspected the prepared diff and changed source at head 28727fd25cc5290d174eb5e4228b698105123c07. No commands or tests were run.

Results

Check Result Note
Source review passed Both changed files read
Tests not run Author reports platform and GPU runs

Findings

Blocking

  • core/libs/prx/libSceAgcDriver/Execution/include/UpscaleMode.hpp:36: The code ignores return values from std::feholdexcept and std::fesetround, then unconditionally calls std::fesetenv(&environment). If either setup operation fails, environment may not contain a valid saved state, and the parser can fail to preserve the caller’s floating-point environment as claimed. Check each return value and handle failure before parsing or restoring.

Non-blocking

None.

Not verified

  • The report’s macOS, Windows, and GPU results were author-reported; I did not run them.
  • files.json and the prepared review/files/ copies were unavailable through the reader. Both changed files were read from the pinned repository head instead. No other changed files were listed in the manifest.

To get this to a good state

Check the floating-point environment operation results and ensure every path restores a valid saved environment before returning or throwing.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6090369941 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27843#pullrequestreview-6090369941). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-27T15:29:28Z. **Review:** CHANGES_REQUESTED --- # Reviewed — comments Changes are required before merge: resolve whether the older macOS parser preserves the floating-point environment when its setup calls fail. ## What I ran Inspected the prepared diff and changed source at head `28727fd25cc5290d174eb5e4228b698105123c07`. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Both changed files read | | Tests | not run | Author reports platform and GPU runs | ## Findings ### Blocking - `core/libs/prx/libSceAgcDriver/Execution/include/UpscaleMode.hpp:36`: The code ignores return values from `std::feholdexcept` and `std::fesetround`, then unconditionally calls `std::fesetenv(&environment)`. If either setup operation fails, `environment` may not contain a valid saved state, and the parser can fail to preserve the caller’s floating-point environment as claimed. Check each return value and handle failure before parsing or restoring. ### Non-blocking None. ## Not verified - The report’s macOS, Windows, and GPU results were author-reported; I did not run them. - `files.json` and the prepared `review/files/` copies were unavailable through the reader. Both changed files were read from the pinned repository head instead. No other changed files were listed in the manifest. ## To get this to a good state Check the floating-point environment operation results and ensure every path restores a valid saved environment before returning or throwing.
MarcZX10 commented 2026-11-27 16:06:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T16:06:52Z.

Review: CHANGES_REQUESTED


Reviewed — changes requested

Changes are required before merge: reject malformed decimal strings in the macOS fallback parser.

What I ran

Reviewed head f775e9b6a4ed7ad7231bd538b0cf9d81ed691e79. Read the prepared description, commits, manifest, diff, both changed files, and the production caller in VulkanDevice.cpp. Used repo_read.py search and bounded reads; no build or tests were run.

Results

Check Result Note
Changed code review failed Found malformed-input acceptance
Build and tests not run No commands run

Findings

Blocking

  • The macOS fallback validates only that every character belongs to a permissive character set, then checks that strtof_l consumed the entire string. Because the filter allows multiple decimal points, strings such as 1..2 pass the character check and strtof_l consumes only 1.; the parser can then accept the malformed value as 1.0. Reject malformed decimal syntax or otherwise require the conversion to consume the full input. core/libs/prx/libSceAgcDriver/Execution/include/UpscaleMode.hpp:52.

Non-blocking

None.

Not verified

Builds, tests, and runtime behavior were not verified. The PR description reports platform checks, but they were not run in this review. files.json was unavailable; the manifest lists two changed files, and both were read in full. VulkanDevice.cpp was read only around the production call site.

To get this to a good state

Reject malformed decimal strings in the macOS fallback and add a regression case such as 1..2; rerun the relevant parser tests and macOS build.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6090771525 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27843#pullrequestreview-6090771525). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-27T16:06:52Z. **Review:** CHANGES_REQUESTED --- # Reviewed — changes requested Changes are required before merge: reject malformed decimal strings in the macOS fallback parser. ## What I ran Reviewed head `f775e9b6a4ed7ad7231bd538b0cf9d81ed691e79`. Read the prepared description, commits, manifest, diff, both changed files, and the production caller in `VulkanDevice.cpp`. Used `repo_read.py` search and bounded reads; no build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Changed code review | failed | Found malformed-input acceptance | | Build and tests | not run | No commands run | ## Findings ### Blocking - The macOS fallback validates only that every character belongs to a permissive character set, then checks that `strtof_l` consumed the entire string. Because the filter allows multiple decimal points, strings such as `1..2` pass the character check and `strtof_l` consumes only `1.`; the parser can then accept the malformed value as `1.0`. Reject malformed decimal syntax or otherwise require the conversion to consume the full input. `core/libs/prx/libSceAgcDriver/Execution/include/UpscaleMode.hpp:52`. ### Non-blocking None. ## Not verified Builds, tests, and runtime behavior were not verified. The PR description reports platform checks, but they were not run in this review. `files.json` was unavailable; the manifest lists two changed files, and both were read in full. `VulkanDevice.cpp` was read only around the production call site. ## To get this to a good state Reject malformed decimal strings in the macOS fallback and add a regression case such as `1..2`; rerun the relevant parser tests and macOS build.
MarcZX10 commented 2026-11-27 17:39:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-27T17:39:41Z.

Review: APPROVED


Reviewed — looks good

The code changes implement the older macOS parsing path and add focused input and floating-point-environment coverage; no defect was verified in the inspected changes.

What I ran

Reviewed head 65d42e289f41899a80645b0068ba80f8bab08794 using repo_read.py to inspect the prepared diff and changed source. No build or tests were run.

Results

Check Result Note
Source review passed Both changed files read
Build and tests not run No commands executed

Findings

Blocking

None.

Non-blocking

None.

Sources

The reviewed changes are in core/libs/prx/libSceAgcDriver/Execution/include/UpscaleMode.hpp and core/libs/prx/libSceAgcDriver/tests/PresentationPass.cpp at the reviewed head.

Not verified

Build and runtime behavior were not verified in this review. The author-reported platform and GPU results in the description were not independently run. files.json was unavailable; the manifest listed two changed files, and both were read.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6091655057 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27843#pullrequestreview-6091655057). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-27T17:39:41Z. **Review:** APPROVED --- # Reviewed — looks good The code changes implement the older macOS parsing path and add focused input and floating-point-environment coverage; no defect was verified in the inspected changes. ## What I ran Reviewed head `65d42e289f41899a80645b0068ba80f8bab08794` using `repo_read.py` to inspect the prepared diff and changed source. No build or tests were run. ## Results | Check | Result | Note | |---|---|---| | Source review | passed | Both changed files read | | Build and tests | not run | No commands executed | ## Findings ### Blocking None. ### Non-blocking None. ## Sources The reviewed changes are in `core/libs/prx/libSceAgcDriver/Execution/include/UpscaleMode.hpp` and `core/libs/prx/libSceAgcDriver/tests/PresentationPass.cpp` at the reviewed head. ## Not verified Build and runtime behavior were not verified in this review. The author-reported platform and GPU results in the description were not independently run. `files.json` was unavailable; the manifest listed two changed files, and both were read. ## To get this to a good state Nothing is required.
ligmaSec commented 2026-12-03 09:26:49 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by ligmaSec on 2026-12-03T09:26:49Z.

Review: COMMENTED


Paired Linux CTest runs of agc_driver_presentation_pass and agc_driver_gcn_scalar_buffer_base passed on b97867d3ce6b and this patch. Both Mesa lavapipe logs show Khronos validation 1.4.369 inserted and zero VUID- errors. The same 10-bit and host-memory subcases skipped on each. I also compiled the exact alternate parser path against Linux POSIX locale headers and verified decimal parsing, subnormals, invalid input, and preservation of the caller's rounding mode and errno. The alternate parser check used Linux.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6166921769 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/27843#pullrequestreview-6166921769). Originally posted by [ligmaSec](https://github.com/ligmaSec) on 2026-12-03T09:26:49Z. **Review:** COMMENTED --- Paired Linux CTest runs of `agc_driver_presentation_pass` and `agc_driver_gcn_scalar_buffer_base` passed on `b97867d3ce6b` and this patch. Both Mesa lavapipe logs show Khronos validation 1.4.369 inserted and zero `VUID-` errors. The same 10-bit and host-memory subcases skipped on each. I also compiled the exact alternate parser path against Linux POSIX locale headers and verified decimal parsing, subnormals, invalid input, and preservation of the caller's rounding mode and errno. The alternate parser check used Linux. AI-assisted: yes.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/27843:upstream-pr/27843'
git switch 'upstream-pr/27843'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/27843'
git switch 'upstream-pr/27843'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/27843'
git switch 'upstream-pr/27843'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/27843'
git switch 'main'
git merge --squash 'upstream-pr/27843'
git switch 'main'
git merge --ff-only 'upstream-pr/27843'
git switch 'main'
git merge 'upstream-pr/27843'
git push origin 'main'
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!27843
No description provided.