Skip to content

fix(agc): restore the standalone visual demo - #2244

Merged
oneandonlydean merged 1 commit into
boykopovar:mainfrom
swagdotsh:fix-agc-visual-demo
Oct 9, 2026
Merged

oneandonlydean merged 1 commit into
boykopovar:mainfrom
swagdotsh:fix-agc-visual-demo

Conversation

@swagdotsh

Copy link
Copy Markdown
Contributor

What

Restore the optional agc_driver_visual_test target. Its manually maintained source list is missing current driver dependencies, and its render setup does not populate the color-target and blend-state lists the driver now uses.

  • Reuse agcDriverSources and link the shader recompiler and libkernel. Copy the unpatched libkernel beside the executable on Windows, together with the existing libc and MinGW runtimes.
  • Set identity color component mapping and populate the color-target and blend-state lists.
  • Keep immutable indices in static storage to avoid the Windows write-watch error with the stack-backed buffer. Wait for GPU completion before comparing indexed and non-indexed pixel readback.

Only the standalone demo and its build definition change. No production shader instruction semantics or system-library exports change.

Overlap review: checked 521 open PRs and inspected the 60 touching the demo or its build files. No duplicate demo repair was found. #2169 adds a source to the manual visual source list replaced here, producing a textual merge conflict; its source is also added to agcDriverSources, which this target now reuses. #1128 formats Visual.cpp. Neither PR is a prerequisite; overlapping edits may need reconciliation when merged.

Tested

Windows 11 x64; Ryzen 9 5900X; NVIDIA RTX 3080 Ti; WinLibs GCC 15.2.0 x86_64-ucrt-posix-seh, release 15.2.0posix-14.0.0-ucrt-r7; CMake 4.3.1; Ninja 1.13.2; Release configuration.

  • Full build and separate libs target passed. Full CTest run with four parallel tests: 506 passed, one expected skip (guest_video_out_wqhd_detection_no_vulkan), zero failures; 63.51 seconds.
  • Fresh standalone build with AGC_BUILD_VISUAL_TEST=ON and BUILD_TESTING=OFF passed.
  • Copied the standalone output files outside the repository. With only Windows system directories on PATH and ANYPS5_NO_SHADER_CACHE=1, three agc_driver_visual_test.exe --verify runs passed. Indexed/non-indexed pixel comparison, triangle-center and background checks passed. The interactive window also displayed the colored triangle.
  • Invalid arguments and a missing vertex shader each returned exit code 1 with the expected diagnostic.
  • python tools/check_conventions.py --base origin/main and git diff --check passed.

No PS5 game was tested. Linux and other GPUs are untested. Contributors with Linux hardware and a Vulkan-capable GPU are invited to build this branch, run agc_driver_visual_test --verify and the interactive demo, and share their distribution, compiler, GPU/driver, and results on this PR. Reports and follow-up fixes are welcome.

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 (no comments added)
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed in TechnicalDebt (no exports or stubs added)
  • 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 (no third-party code added)
  • Generic behaviour, not specific to one title
  • Depends on: none
  • AI-assisted: yes, OpenAI Codex

@AnzouBelilita

Copy link
Copy Markdown

Independent Windows/Vulkan validation on a second GPU:

  • OS: Windows 10 Pro, build 19045
  • GPU: AMD Radeon RX 580 Series; driver 31.0.21924.61
  • Toolchain: MinGW-w64 GCC 16.2.0 (x86_64-ucrt-posix-seh), CMake 4.4.4, Ninja 1.13.2
  • Clean standalone-target rebuild: cmake --build build-pr2244 --target clean, followed by cmake --build build-pr2244 --target agc_driver_visual_test --parallel 4 — passed, 636 build steps, exit code 0.
  • GPU verification: agc_driver_visual_test.exe --verify passed 3 consecutive runs. GPU readback was verified each time; all runs exited with code 0.
  • Conventions: python tools/check_conventions.py --base d70b89989473ba1f6ae13e44e079e67f1f8a44b0 and git diff --check both passed.

This validates the standalone visual-test target on an RX 580. The full repository build and full CTest suite were not run.

@krishalivaibhav

Copy link
Copy Markdown
Contributor

Native Apple M2 validation passed for this PR in a local integration with the existing macOS dependencies.

Environment: Apple M2, 16 GB RAM; macOS 27.2 beta 3; Apple Clang 21.0.0 / SDK 27.0; CMake 4.4.4; Ninja 1.13.2; MoltenVK 1.4.2. Release ARM64 build with pinned dependencies and bundled SDL compiled from source.

Exact integration:

The visual source-list merge conflict was resolved using this PR's ${agcDriverSources}, retaining the macOS integration and library linking. These results depend on the combined branches; they do not establish that #2244 alone works on macOS. No additional production fix was authored.

Results:

  • agc_driver_visual_test --verify passed the initial run, an independent subagent rerun, and three subsequent runs. GPU checks required Vulkan initialization, selected Apple M2, disabled the shader disk cache, and had an external 30-second process timeout.
  • Indexed/non-indexed full-buffer readback comparison, triangle-center checks, and background checks passed. Logs confirm an Apple M2 device, Vulkan surface, 640×480 swapchain, and a 1,228,800-byte presentation upload. Verification exited with status 0 after the final wait and teardown.
  • Invalid arguments returned status 1 with the usage diagnostic. A copied binary outside the shader directory returned status 1 with the expected missing Triangle.vert.spv diagnostic; original assets were untouched.
  • After integration, placeholder-image and shader-profile CPU checks, plus constant-store, typed-heaps, and vertex-fetch GPU checks, passed again. Constant-store checks also passed with default, full, and disabled optimization. An independent subagent reviewed the integration and reran the visual verification.

Limitations: Visible output and interactive window closing remain unverified: the interactive process initialized, but desktop automation could not inspect the standalone executable or send Escape because macOS denied accessibility access. That process was stopped externally. The demo creates a non-resizable window. Its shaders are GLSL-generated SPIR-V; the separate vertex-fetch fixture exercises guest-recompiled shaders. No games or full suite were tested. The placeholder fallback's null-image writes are not equivalent to discarded null-descriptor writes.

Build/run configuration, with repo and build set to the local integration and build directory:

cmake -S "$repo" -B "$build" -G Ninja   -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64   -DCMAKE_OSX_DEPLOYMENT_TARGET=27.0 -DBUILD_TESTING=ON   -DANYPS5_ENABLE_SPIRV_TOOLS=ON -DAGC_BUILD_VISUAL_TEST=ON
cmake --build "$build" --target agc_driver_visual_test -j 4
unset APS5_SPIRV_OPT
env VK_DRIVER_FILES=/opt/homebrew/opt/molten-vk/etc/vulkan/icd.d/MoltenVK_icd.json   DYLD_LIBRARY_PATH=/opt/homebrew/opt/vulkan-loader/lib   ANYPS5_REQUIRE_VULKAN=1 ANYPS5_NO_SHADER_CACHE=1 ANYPS5_GPU='Apple M2'   "$build/tests/agc_driver_visual_test" --verify

The actual checks used a Python subprocess wrapper with a 30-second timeout. Reproduction requires the integrated branches listed above. AI-assisted validation using Codex, with independent subagent review.

@krishalivaibhav

Copy link
Copy Markdown
Contributor

Follow-up human validation on the Apple M2: the triangle displayed correctly, including the requested cover/uncover check. Focusing the demo and pressing Escape closed it normally; the process exited0. On a separate relaunch, clicking the red window-close button also closed it normally with exit0. This completes the previously pending visible-output and physical close-event checks for this local integrated demo. It does not establish game compatibility or that PR2244 alone runs on macOS.

@AnzouBelilita

Copy link
Copy Markdown

Independent controlled RX 580 verification (Windows; Radeon RX 580 Series; driver 31.0.21924.61). I clean-configured and built agc_driver_visual_test from both source revisions using Release + Ninja + GCC/G++ 16.2.0, with AGC_BUILD_VISUAL_TEST=ON.

  • Current main (43dd25d2f1fc0a0a29af09454c0faf5b91041b2a): fresh build succeeded; --verify failed 3/3 runs with GPU readback: triangle center was not rendered (exit 1 each run).
  • This PR head (1c71428f828284b9e87c461b1a698ff0ef73acef): clean configure and fresh 636-step build succeeded; --verify passed 3/3 runs on the same RX 580, each printing SPIR-V triangle rendered, GPU readback verified (exit 0).
  • ANYPS5_NO_SHADER_CACHE=1 was set for all six runs. No source files were changed; no duplicate PR was opened.

This is a repeatable baseline-vs-PR result on one GPU/driver and supports the fix on RX 580, while not claiming root-cause proof or broader hardware coverage. Full local report: H:\AnyPS5\build-visual-current\RX580-main-vs-PR2244-comparison.txt.

@oneandonlydean
oneandonlydean merged commit 4623971 into boykopovar:main Oct 9, 2026
1 check passed
@swagdotsh
swagdotsh deleted the fix-agc-visual-demo branch October 12, 2026 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agc libSceAgc* build

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants