feat(videoout): apply the output gamma from sceVideoOutAdjustColor #4040
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4040"
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 ee6aba54 on 2026-10-11T21:57:52Z.
What
sceVideoOutAdjustColorstored the gamma of the color settings, but presentation ignored it. PPSA18391 (engine: Clickteam Fusion) sets a gamma of 2.0 and looks washed out without it.VideoOut now passes the gamma to the driver (
AgcDriverSetOutputGamma_nid_postfix). When it is not 1, presentation copies the finished swapchain image into an RGBA8 storage image, appliesout = in ^ gammato the color channels in a compute pass (OutputGamma.comp) and copies the result back. Swapchain images are created as transfer sources when the surface allows it. Frame dumps (APS5_DUMP_FRAMES) apply the same gamma, so they match the presented image. The console's transfer curve and value range are unverified on hardware; the TechnicalDebt entry forsceVideoOutAdjustColorsays so.Tested
18c438b10.agc_driver_graphicsgainsoutputGammaTests: gamma 1 leaves the image unchanged, gamma 2 maps 128 to 64, 51 to 10 and 204 to 163 and keeps alpha.agc_driver_graphicsand thevideo_outtests pass on the rebased branch; the fullctestrun (992 tests) was on the previous base5efd09afc.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-13T03:34:44Z.
A Windows build and run, since the description says Windows wasn't built or tested.
Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head 4b0d7224a merged into
main495bf91a0, which passes 1023 of 1023 on both GPUs.libsincluded.agc_driver_graphics(withoutputGammaTests) passes on both GPUs with--repeat until-fail:3. The full suite (ctest --timeout 120 --parallel 4) passes 1023 of 1023 on both.main, the test doesn't link, becauseAgcDriver::ApplyOutputGammais new.Not run: a title.
Written with AI assistance.
Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-13T10:33:41Z.
Review: CHANGES_REQUESTED
Thanks for the PR, and for the Windows run by @kr4y4. Findings:
core/libs/prx/libSceVideoOut/src/Output.cpp:313:settings->gammagoes to the driver unchecked.sceVideoOutColorSettingsSetGamma(same file) only accepts finite values in 0.1–2.0; an uninitialised or hand-built struct with 0, a negative value or NaN reachespowinOutputGamma.comp(all-white or NaN output). Validate it here, with the same range, and say in TechnicalDebt that the range is inferred.core/libs/prx/libSceAgcDriver/tests/Graphics.cpp:403(outputGammaTests) only exercisesApplyOutputGamma, the CPU table used for frame dumps. What is presented isPresentationGamma::Record+OutputGamma.comp, which usespowon the GPU and no 8-bit rounding table, so the two can differ and nothing pins the real path. Add a test that runsRecordon a small image (gamma 1 unchanged, gamma 2 on 51/128/204, alpha kept, a size that is not a multiple of 8) and compares withApplyOutputGamma.in^gammais the only evidence from a hand check against a recording, which we can't reproduce. shadPS4'spost_process.fragapplies a different curve (pow(rgb, 1/(2.4 + 1 - gamma))with a linear segment), and KytyPS5 only stores the value. Please attach the evidence (the recording frame vs. a dump with the PR, or the console measurement) in the PR, and note in TechnicalDebt that the curve differs from shadPS4's.eligibilitycheck failure is an infra error (proxy fetch), not caused by this PR.Happy to look again once these are addressed.
Imported from boykopovar/AnyPS5. Originally posted by ee6aba54 on 2026-10-13T19:14:05Z.
Rebased onto
18c438b10:366c6e414. The only conflict wasPostCompile.cmake, where the test targets now link the library;PresentationGamma.cppand theOutputGammashader header are added tolibSceAgcDriverandagc_driver_visual_testonly. No change to the code of this PR; the review points above are still open and will come in a separate update.Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-14T10:34:34Z.
Review: CHANGES_REQUESTED
Thanks for the rebase. It leaves the code unchanged, so the three points from the earlier review are still open:
core/libs/prx/libSceVideoOut/src/Output.cpp:313: validatesettings->gammawith the same finite 0.1–2.0 range assceVideoOutColorSettingsSetGammabefore it reachespowinOutputGamma.comp, and note in TechnicalDebt that the range is inferred.core/libs/prx/libSceAgcDriver/tests/Graphics.cpp:404:outputGammaTestsonly coversApplyOutputGamma(frame dumps); a test ofPresentationGamma::Recordon a small image (width not a multiple of 8) compared with it is still missing.in^gamma(recording frame vs. a dump with this PR, or a console measurement) and note in TechnicalDebt that shadPS4 uses a different curve.The branch also conflicts with
maininVulkanDevice.cpp. Since you mentioned an update is coming, I'm leaving the code to you; I'll look again then.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T03:11:37Z.
Review: COMMENTED
Reviewed — no blocking findings
Nothing blocks this change; the implementation is coherent in the inspected code, with one compatibility concern to consider.
What I ran
Reviewed head
366c6e4148c0b6267898fda5982b0b75094dc822using the prepared review bundle andrepo_read.pyfor targeted source context. No build or tests were run. The author reports test results indescription.md; they were not independently verified.Results
Findings
Blocking
None.
Non-blocking
VulkanDevice.cpp:2848). This can make a title fail during presentation aftersceVideoOutAdjustColorsucceeds. Consider returning an error or selecting a fallback when gamma is requested on such a surface.Not verified
manifest.json:Presentation.hpp,PresentationGamma.hpp,EntryPoints.cpp,PresentationGamma.cpp,VulkanDevice.cpp,OutputGamma.comp,PostCompile.cmake,Graphics.cpp,Output.cpp, andlibSceVideoOut.md. No changed files were excluded by the manifest.To get this to a good state
Nothing is required. Consider handling surfaces without transfer-source support without failing presentation.
Pull request closed