Skip to content

feat(videoout): apply the output gamma from sceVideoOutAdjustColor - #4040

Open
ee6aba54 wants to merge 1 commit into
boykopovar:mainfrom
ee6aba54:feat/videoout-output-gamma
Open

ee6aba54 wants to merge 1 commit into
boykopovar:mainfrom
ee6aba54:feat/videoout-output-gamma

Conversation

@ee6aba54

@ee6aba54 ee6aba54 commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

What

sceVideoOutAdjustColor stored 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, applies out = in ^ gamma to 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 for sceVideoOutAdjustColor says so.

Tested

  • Ubuntu 24.04, Linux 7.0, GCC 13.3, Release, rebased onto 18c438b10. agc_driver_graphics gains outputGammaTests: gamma 1 leaves the image unchanged, gamma 2 maps 128 to 64, 51 to 10 and 204 to 163 and keeps alpha. agc_driver_graphics and the video_out tests pass on the rebased branch; the full ctest run (992 tests) was on the previous base 5efd09afc.
  • PPSA18391: with gamma 2.0 applied, the title screen matches a recording from the console; checked by hand on an earlier base.
  • Windows not built or tested.

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 in TechnicalDebt
  • 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
  • AI-assisted: yes

🤖 Generated with Claude Code

@ee6aba54
ee6aba54 force-pushed the feat/videoout-output-gamma branch from 29dbbf0 to 191ac23 Compare October 11, 2026 22:26
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@ee6aba54
ee6aba54 force-pushed the feat/videoout-output-gamma branch from 191ac23 to cf1d324 Compare October 12, 2026 10:09
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@github-actions github-actions Bot added the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@ee6aba54
ee6aba54 force-pushed the feat/videoout-output-gamma branch from cf1d324 to 4b0d722 Compare October 12, 2026 21:18
@github-actions github-actions Bot removed the needs rebase Conflicts with main, rebase needed label Oct 12, 2026
@blawesom

Copy link
Copy Markdown
Contributor

Validation: PR #4040 @ 366c6e4

Verdict: PASS (Linux / AMD scoped; see Limitations)

Environment

  • Machine: CachyOS, kernel 7.3.4-1-cachyos, Ryzen 7 9800X3D, AMD Radeon RX 9070 XT (RADV GFX1201) + AI PRO R9700, /dev/kfd present
  • PR state at validation: OPEN, not locked, not merged; head = 366c6e4148c0b6267898fda5982b0b75094dc822 (matches frozen queue head)
  • Baseline: origin/main = 0f4538fa022a7d82d467fd74e112514abc30345f (prebuilt worktree, reused read-only)
  • Candidate worktree: /home/benj/scratch/wt5/pr-4040 @ 366c6e4148c0b6267898fda5982b0b75094dc822, submodules initialized

Build

  • Configure: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=gcc -DCMAKE_CXX_COMPILER=g++ -DBUILD_TESTING=ON → exit 0, wall ~6 s
  • Build: cmake --build build --parallel 12 (CMAKE_BUILD_PARALLEL_LEVEL=12, MAKEFLAGS=-j12) → exit 0, wall 2 m 04 s, 3162 targets, no errors

Focused tests (VideoOut output gamma / sceVideoOutAdjustColor)

Pattern (identical matched set of 15 tests in both trees, verified by diff):

^(agc_driver_graphics|agc_driver_image_sample_force_degamma|video_out_mouse|video_out_output_mode_policy|video_out_flip_lifetime|video_out_flip_reopen|video_out_flip_decode|video_out_flip_controls|video_out_flip_overlay|video_out_flip_unopened|video_out_frame_dump_queue|guest_video_out_high_frame_rate|guest_video_out_wqhd_detection|guest_video_out_resolution_status|guest_video_out_output_mode)$

Command on both trees:

ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation \
VK_ADD_LAYER_PATH=/home/benj/scratch/vvl-layer VK_LOADER_DEBUG=layer ANYPS5_GPU='AMD Radeon RX 9070 XT' \
ctest --test-dir build -R '<pattern>' -V

Results (identical in base and PR trees)

Test base PR
agc_driver_graphics Passed Passed (includes the new outputGammaTests from this PR)
agc_driver_image_sample_force_degamma Passed Passed
video_out_mouse Passed Passed
video_out_output_mode_policy Passed Passed
guest_video_out_high_frame_rate Passed Passed
video_out_flip_decode Passed Passed
guest_video_out_wqhd_detection Passed Passed
guest_video_out_resolution_status Passed Passed
guest_video_out_output_mode Passed Passed
video_out_flip_lifetime / _reopen / _controls / _overlay / _unopened / video_out_frame_dump_queue Skipped Skipped (same reason both trees)
  • ctest exit code: 0 on both trees; 100% tests passed out of 15 on both (9 passed, 6 skipped, 0 failed)

Vulkan validation-layer checks (per AGENTS.md)

  • was not found but was requested by env var VK_INSTANCE_LAYERS: absent in both logs (0 occurrences)
  • Insert instance layer "VK_LAYER_KHRONOS_validation": present in both logs (5 occurrences each; loader also logged env var 'VK_INSTANCE_LAYERS' defined and adding layers)
  • GPU actually used: AMD Radeon RX 9070 XT selected in both runs (15 mentions each), agc_driver_graphics ran GPU work (2.16 s on PR)
  • VUID- IDs: 0 in base, 0 in PR → no new validation IDs
  • SYNC-HAZARD IDs: 0 in both; Validation Error/Warning lines: 0 in both
  • New bracketed diagnostic IDs introduced by the PR: none (full ID diff of the two logs is empty)

Push

  • Pushed frozen head as-is (no rebase): git push fork +366c6e4148c0b6267898fda5982b0b75094dc822:refs/heads/validation/pr-4040 → blawesom/AnyPS5 branch validation/pr-4040 (exit 0)

Limitations

  • Scoped to Linux + AMD Radeon RX 9070 XT (RADV GFX1201) only; no NVIDIA/Intel/AMD-PRO or Windows coverage.
  • The 6 video_out_flip_* / video_out_frame_dump_queue tests skipped identically on both trees: the SDL offscreen test driver has no Vulkan support (DisplayWindow: Vulkan support is either not configured in SDL or not available in current SDL video driver (offscreen)), so the actual swapchain-presentation gamma path (OutputGamma.comp on the presented image) was not exercised by the flip tests on this host. The gamma math itself was exercised by agc_driver_graphics (outputGammaTests), which passed.
  • The PR branch base is older than current origin/main; the focused set was restricted to the 15 test names present in both trees.
  • Single run per tree (no repetition), so intermittent faults are not excluded.

@MarcZX10 MarcZX10 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.

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 366c6e4148c0b6267898fda5982b0b75094dc822 using the prepared review bundle and repo_read.py for targeted source context. No build or tests were run. The author reports test results in description.md; they were not independently verified.

Results

Check Result Note
Patch and source review passed Reviewed all 10 changed files
Build and tests not run Author-reported results only
Hardware behavior not run Console transfer curve and range unverified

Findings

Blocking

None.

Non-blocking

  • The surface capability is checked when constructing/resizing the swapchain, but gamma application later throws if transfer-source images are unsupported (VulkanDevice.cpp:2848). This can make a title fail during presentation after sceVideoOutAdjustColor succeeds. Consider returning an error or selecting a fallback when gamma is requested on such a surface.

Not verified

  • No build, test suite, negative control, or physical-console run was performed. The reported Ubuntu tests and PPSA18391 comparison were not independently checked.
  • Read all changed files listed as included in manifest.json: Presentation.hpp, PresentationGamma.hpp, EntryPoints.cpp, PresentationGamma.cpp, VulkanDevice.cpp, OutputGamma.comp, PostCompile.cmake, Graphics.cpp, Output.cpp, and libSceVideoOut.md. No changed files were excluded by the manifest.
  • Did not inspect broader callers or platform-specific behavior beyond the targeted source ranges.

To get this to a good state

Nothing is required. Consider handling surfaces without transfer-source support without failing presentation.

This branch has not been deployed

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

Labels

agc libSceAgc* build docs needs rebase Conflicts with main, rebase needed prx

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants